diff --git a/app/composer.json b/app/composer.json index 224b79a7..6cfb6b0e 100644 --- a/app/composer.json +++ b/app/composer.json @@ -5,17 +5,17 @@ "type": "project", "license": "MIT", "require": { - "php": ">=7.2", - "cakephp/cakephp": "~4.2.0", - "cakephp/migrations": "^3.0", + "php": ">=8.0", + "cakephp/cakephp": "^4.3", + "cakephp/migrations": "^3.2", "cakephp/plugin-installer": "^1.3", - "doctrine/dbal": "^3.1", + "doctrine/dbal": "^3.3", "mobiledetect/mobiledetectlib": "^2.8" }, "require-dev": { - "cakephp/bake": "^2.3", - "cakephp/cakephp-codesniffer": "~4.2.0", - "cakephp/debug_kit": "^4.4", + "cakephp/bake": "^2.6", + "cakephp/cakephp-codesniffer": "^4.5", + "cakephp/debug_kit": "^4.5", "josegonzalez/dotenv": "^3.2", "phpunit/phpunit": "~8.5.0 || ^9.3", "psy/psysh": "@stable" @@ -50,6 +50,10 @@ }, "prefer-stable": true, "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true, + "cakephp/plugin-installer": true + } } } diff --git a/app/composer.lock b/app/composer.lock index 6d038a60..481ace0d 100644 --- a/app/composer.lock +++ b/app/composer.lock @@ -4,37 +4,38 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4a9daa84e3933b986228e0ddedeaf958", + "content-hash": "60f77f61fc803e4b2b9295e4ab5bfa10", "packages": [ { "name": "cakephp/cakephp", - "version": "4.2.9", + "version": "4.3.9", "source": { "type": "git", "url": "https://github.com/cakephp/cakephp.git", - "reference": "6cb068fd328219d79a02ef6df439b73459071368" + "reference": "6548d1141fc8311d0fd4d6acdd18446d4279fe32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/cakephp/zipball/6cb068fd328219d79a02ef6df439b73459071368", - "reference": "6cb068fd328219d79a02ef6df439b73459071368", + "url": "https://api.github.com/repos/cakephp/cakephp/zipball/6548d1141fc8311d0fd4d6acdd18446d4279fe32", + "reference": "6548d1141fc8311d0fd4d6acdd18446d4279fe32", "shasum": "" }, "require": { - "cakephp/chronos": "^2.0", + "cakephp/chronos": "^2.2", "composer/ca-bundle": "^1.2", "ext-intl": "*", "ext-json": "*", "ext-mbstring": "*", "laminas/laminas-diactoros": "^2.2.2", "laminas/laminas-httphandlerrunner": "^1.1", - "league/container": "^3.2", + "league/container": "^4.2.0", "php": ">=7.2.0", + "psr/container": "^1.1 || ^2.0", "psr/http-client": "^1.0", "psr/http-server-handler": "^1.0", "psr/http-server-middleware": "^1.0", - "psr/log": "^1.0.0", - "psr/simple-cache": "^1.0.0" + "psr/log": "^1.0 || ^2.0", + "psr/simple-cache": "^1.0 || ^2.0" }, "replace": { "cakephp/cache": "self.version", @@ -54,8 +55,8 @@ "cakephp/validation": "self.version" }, "require-dev": { - "cakephp/cakephp-codesniffer": "^4.0", - "mikey179/vfsstream": "^1.6", + "cakephp/cakephp-codesniffer": "^4.5", + "mikey179/vfsstream": "^1.6.10", "paragonie/csp-builder": "^2.3", "phpunit/phpunit": "^8.5 || ^9.3" }, @@ -67,16 +68,16 @@ }, "type": "library", "autoload": { - "psr-4": { - "Cake\\": "src/" - }, "files": [ "src/Core/functions.php", "src/Collection/functions.php", "src/I18n/functions.php", "src/Routing/functions.php", "src/Utility/bootstrap.php" - ] + ], + "psr-4": { + "Cake\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -107,20 +108,20 @@ "issues": "https://github.com/cakephp/cakephp/issues", "source": "https://github.com/cakephp/cakephp" }, - "time": "2021-09-11T00:24:13+00:00" + "time": "2022-05-14T01:25:15+00:00" }, { "name": "cakephp/chronos", - "version": "2.2.0", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/cakephp/chronos.git", - "reference": "556e14da67307ffc2e68beeb7df0694dc8d1207d" + "reference": "3ecd6e7ae191c676570cd1bed51fd561de4606dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/chronos/zipball/556e14da67307ffc2e68beeb7df0694dc8d1207d", - "reference": "556e14da67307ffc2e68beeb7df0694dc8d1207d", + "url": "https://api.github.com/repos/cakephp/chronos/zipball/3ecd6e7ae191c676570cd1bed51fd561de4606dd", + "reference": "3ecd6e7ae191c676570cd1bed51fd561de4606dd", "shasum": "" }, "require": { @@ -132,12 +133,12 @@ }, "type": "library", "autoload": { - "psr-4": { - "Cake\\Chronos\\": "src/" - }, "files": [ "src/carbon_compat.php" - ] + ], + "psr-4": { + "Cake\\Chronos\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -166,33 +167,33 @@ "issues": "https://github.com/cakephp/chronos/issues", "source": "https://github.com/cakephp/chronos" }, - "time": "2021-06-17T13:49:10+00:00" + "time": "2021-10-17T02:44:05+00:00" }, { "name": "cakephp/migrations", - "version": "3.1.0", + "version": "3.5.2", "source": { "type": "git", "url": "https://github.com/cakephp/migrations.git", - "reference": "d22737c31243db89774abfe6a077d254c0eae75a" + "reference": "e1b03bfef53ce41feabbf2120021ad5187e80289" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/migrations/zipball/d22737c31243db89774abfe6a077d254c0eae75a", - "reference": "d22737c31243db89774abfe6a077d254c0eae75a", + "url": "https://api.github.com/repos/cakephp/migrations/zipball/e1b03bfef53ce41feabbf2120021ad5187e80289", + "reference": "e1b03bfef53ce41feabbf2120021ad5187e80289", "shasum": "" }, "require": { - "cakephp/cache": "^4.0.5", - "cakephp/orm": "^4.0.5", + "cakephp/cache": "^4.3.0", + "cakephp/orm": "^4.3.0", "php": ">=7.2.0", "robmorgan/phinx": "^0.12" }, "require-dev": { - "cakephp/bake": "^2.1.0", - "cakephp/cakephp": "^4.0.5", - "cakephp/cakephp-codesniffer": "~4.1.0", - "phpunit/phpunit": "~8.5.0" + "cakephp/bake": "^2.6.0", + "cakephp/cakephp": "^4.3.0", + "cakephp/cakephp-codesniffer": "^4.1", + "phpunit/phpunit": "^8.5.0 || ^9.5.0" }, "suggest": { "cakephp/bake": "If you want to generate migrations.", @@ -226,7 +227,7 @@ "issues": "https://github.com/cakephp/migrations/issues", "source": "https://github.com/cakephp/migrations" }, - "time": "2021-05-20T13:57:37+00:00" + "time": "2022-05-10T15:01:58+00:00" }, { "name": "cakephp/plugin-installer", @@ -279,16 +280,16 @@ }, { "name": "composer/ca-bundle", - "version": "1.2.11", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "0b072d51c5a9c6f3412f7ea3ab043d6603cb2582" + "reference": "4c679186f2aca4ab6a0f1b0b9cf9252decb44d0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/0b072d51c5a9c6f3412f7ea3ab043d6603cb2582", - "reference": "0b072d51c5a9c6f3412f7ea3ab043d6603cb2582", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/4c679186f2aca4ab6a0f1b0b9cf9252decb44d0b", + "reference": "4c679186f2aca4ab6a0f1b0b9cf9252decb44d0b", "shasum": "" }, "require": { @@ -335,7 +336,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/ca-bundle/issues", - "source": "https://github.com/composer/ca-bundle/tree/1.2.11" + "source": "https://github.com/composer/ca-bundle/tree/1.3.1" }, "funding": [ { @@ -351,80 +352,7 @@ "type": "tidelift" } ], - "time": "2021-09-25T20:32:43+00:00" - }, - { - "name": "composer/package-versions-deprecated", - "version": "1.11.99.4", - "source": { - "type": "git", - "url": "https://github.com/composer/package-versions-deprecated.git", - "reference": "b174585d1fe49ceed21928a945138948cb394600" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b174585d1fe49ceed21928a945138948cb394600", - "reference": "b174585d1fe49ceed21928a945138948cb394600", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.1.0 || ^2.0", - "php": "^7 || ^8" - }, - "replace": { - "ocramius/package-versions": "1.11.99" - }, - "require-dev": { - "composer/composer": "^1.9.3 || ^2.0@dev", - "ext-zip": "^1.13", - "phpunit/phpunit": "^6.5 || ^7" - }, - "type": "composer-plugin", - "extra": { - "class": "PackageVersions\\Installer", - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "PackageVersions\\": "src/PackageVersions" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be" - } - ], - "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", - "support": { - "issues": "https://github.com/composer/package-versions-deprecated/issues", - "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.4" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2021-09-13T08:41:34+00:00" + "time": "2021-10-28T20:44:15+00:00" }, { "name": "doctrine/cache", @@ -527,36 +455,38 @@ }, { "name": "doctrine/dbal", - "version": "3.1.3", + "version": "3.3.6", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "96b0053775a544b4a6ab47654dac0621be8b4cf8" + "reference": "9e7f76dd1cde81c62574fdffa5a9c655c847ad21" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/96b0053775a544b4a6ab47654dac0621be8b4cf8", - "reference": "96b0053775a544b4a6ab47654dac0621be8b4cf8", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/9e7f76dd1cde81c62574fdffa5a9c655c847ad21", + "reference": "9e7f76dd1cde81c62574fdffa5a9c655c847ad21", "shasum": "" }, "require": { - "composer/package-versions-deprecated": "^1.11.99", - "doctrine/cache": "^1.0|^2.0", - "doctrine/deprecations": "^0.5.3", + "composer-runtime-api": "^2", + "doctrine/cache": "^1.11|^2.0", + "doctrine/deprecations": "^0.5.3|^1", "doctrine/event-manager": "^1.0", - "php": "^7.3 || ^8.0" + "php": "^7.3 || ^8.0", + "psr/cache": "^1|^2|^3", + "psr/log": "^1|^2|^3" }, "require-dev": { "doctrine/coding-standard": "9.0.0", - "jetbrains/phpstorm-stubs": "2021.1", - "phpstan/phpstan": "0.12.99", - "phpstan/phpstan-strict-rules": "^0.12.11", - "phpunit/phpunit": "9.5.10", + "jetbrains/phpstorm-stubs": "2022.1", + "phpstan/phpstan": "1.6.3", + "phpstan/phpstan-strict-rules": "^1.2", + "phpunit/phpunit": "9.5.20", "psalm/plugin-phpunit": "0.16.1", - "squizlabs/php_codesniffer": "3.6.0", + "squizlabs/php_codesniffer": "3.6.2", "symfony/cache": "^5.2|^6.0", - "symfony/console": "^2.0.5|^3.0|^4.0|^5.0|^6.0", - "vimeo/psalm": "4.10.0" + "symfony/console": "^2.7|^3.0|^4.0|^5.0|^6.0", + "vimeo/psalm": "4.23.0" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." @@ -616,7 +546,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.1.3" + "source": "https://github.com/doctrine/dbal/tree/3.3.6" }, "funding": [ { @@ -632,29 +562,29 @@ "type": "tidelift" } ], - "time": "2021-10-02T16:15:05+00:00" + "time": "2022-05-02T17:21:01+00:00" }, { "name": "doctrine/deprecations", - "version": "v0.5.3", + "version": "v1.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "9504165960a1f83cc1480e2be1dd0a0478561314" + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/9504165960a1f83cc1480e2be1dd0a0478561314", - "reference": "9504165960a1f83cc1480e2be1dd0a0478561314", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", "shasum": "" }, "require": { "php": "^7.1|^8.0" }, "require-dev": { - "doctrine/coding-standard": "^6.0|^7.0|^8.0", - "phpunit/phpunit": "^7.0|^8.0|^9.0", - "psr/log": "^1.0" + "doctrine/coding-standard": "^9", + "phpunit/phpunit": "^7.5|^8.5|^9.5", + "psr/log": "^1|^2|^3" }, "suggest": { "psr/log": "Allows logging deprecations via PSR-3 logger implementation" @@ -673,9 +603,9 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/v0.5.3" + "source": "https://github.com/doctrine/deprecations/tree/v1.0.0" }, - "time": "2021-03-21T12:59:47+00:00" + "time": "2022-05-02T15:47:09+00:00" }, { "name": "doctrine/event-manager", @@ -773,16 +703,16 @@ }, { "name": "laminas/laminas-diactoros", - "version": "2.8.0", + "version": "2.10.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-diactoros.git", - "reference": "0c26ef1d95b6d7e6e3943a243ba3dc0797227199" + "reference": "a3f03b3c158a3a7014c6ba553b0cb83bf7da19c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-diactoros/zipball/0c26ef1d95b6d7e6e3943a243ba3dc0797227199", - "reference": "0c26ef1d95b6d7e6e3943a243ba3dc0797227199", + "url": "https://api.github.com/repos/laminas/laminas-diactoros/zipball/a3f03b3c158a3a7014c6ba553b0cb83bf7da19c4", + "reference": "a3f03b3c158a3a7014c6ba553b0cb83bf7da19c4", "shasum": "" }, "require": { @@ -868,7 +798,7 @@ "type": "community_bridge" } ], - "time": "2021-09-22T03:54:36+00:00" + "time": "2022-05-04T15:16:15+00:00" }, { "name": "laminas/laminas-httphandlerrunner", @@ -943,26 +873,26 @@ }, { "name": "laminas/laminas-zendframework-bridge", - "version": "1.4.0", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-zendframework-bridge.git", - "reference": "bf180a382393e7db5c1e8d0f2ec0c4af9c724baf" + "reference": "7f049390b756d34ba5940a8fb47634fbb51f79ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-zendframework-bridge/zipball/bf180a382393e7db5c1e8d0f2ec0c4af9c724baf", - "reference": "bf180a382393e7db5c1e8d0f2ec0c4af9c724baf", + "url": "https://api.github.com/repos/laminas/laminas-zendframework-bridge/zipball/7f049390b756d34ba5940a8fb47634fbb51f79ab", + "reference": "7f049390b756d34ba5940a8fb47634fbb51f79ab", "shasum": "" }, "require": { - "php": "^7.3 || ~8.0.0 || ~8.1.0" + "php": ">=7.4, <8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3", - "psalm/plugin-phpunit": "^0.15.1", - "squizlabs/php_codesniffer": "^3.5", - "vimeo/psalm": "^4.6" + "phpunit/phpunit": "^9.5.14", + "psalm/plugin-phpunit": "^0.15.2", + "squizlabs/php_codesniffer": "^3.6.2", + "vimeo/psalm": "^4.21.0" }, "type": "library", "extra": { @@ -1001,25 +931,25 @@ "type": "community_bridge" } ], - "time": "2021-09-03T17:53:30+00:00" + "time": "2022-02-22T22:17:01+00:00" }, { "name": "league/container", - "version": "3.4.1", + "version": "4.2.0", "source": { "type": "git", "url": "https://github.com/thephpleague/container.git", - "reference": "84ecbc2dbecc31bd23faf759a0e329ee49abddbd" + "reference": "375d13cb828649599ef5d48a339c4af7a26cd0ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/container/zipball/84ecbc2dbecc31bd23faf759a0e329ee49abddbd", - "reference": "84ecbc2dbecc31bd23faf759a0e329ee49abddbd", + "url": "https://api.github.com/repos/thephpleague/container/zipball/375d13cb828649599ef5d48a339c4af7a26cd0ab", + "reference": "375d13cb828649599ef5d48a339c4af7a26cd0ab", "shasum": "" }, "require": { - "php": "^7.0 || ^8.0", - "psr/container": "^1.0.0" + "php": "^7.2 || ^8.0", + "psr/container": "^1.1 || ^2.0" }, "provide": { "psr/container-implementation": "^1.0" @@ -1028,15 +958,19 @@ "orno/di": "~2.0" }, "require-dev": { - "phpunit/phpunit": "^6.0 || ^7.0", + "nette/php-generator": "^3.4", + "nikic/php-parser": "^4.10", + "phpstan/phpstan": "^0.12.47", + "phpunit/phpunit": "^8.5.17", "roave/security-advisories": "dev-latest", "scrutinizer/ocular": "^1.8", - "squizlabs/php_codesniffer": "^3.5" + "squizlabs/php_codesniffer": "^3.6" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.x-dev", + "dev-master": "4.x-dev", + "dev-4.x": "4.x-dev", "dev-3.x": "3.x-dev", "dev-2.x": "2.x-dev", "dev-1.x": "1.x-dev" @@ -1054,8 +988,7 @@ "authors": [ { "name": "Phil Bennett", - "email": "philipobenito@gmail.com", - "homepage": "http://www.philipobenito.com", + "email": "mail@philbennett.co.uk", "role": "Developer" } ], @@ -1072,7 +1005,7 @@ ], "support": { "issues": "https://github.com/thephpleague/container/issues", - "source": "https://github.com/thephpleague/container/tree/3.4.1" + "source": "https://github.com/thephpleague/container/tree/4.2.0" }, "funding": [ { @@ -1080,20 +1013,20 @@ "type": "github" } ], - "time": "2021-07-09T08:23:52+00:00" + "time": "2021-11-16T10:29:06+00:00" }, { "name": "mobiledetect/mobiledetectlib", - "version": "2.8.37", + "version": "2.8.39", "source": { "type": "git", "url": "https://github.com/serbanghita/Mobile-Detect.git", - "reference": "9841e3c46f5bd0739b53aed8ac677fa712943df7" + "reference": "0fd6753003fc870f6e229bae869cc1337c99bc45" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/9841e3c46f5bd0739b53aed8ac677fa712943df7", - "reference": "9841e3c46f5bd0739b53aed8ac677fa712943df7", + "url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/0fd6753003fc870f6e229bae869cc1337c99bc45", + "reference": "0fd6753003fc870f6e229bae869cc1337c99bc45", "shasum": "" }, "require": { @@ -1104,12 +1037,12 @@ }, "type": "library", "autoload": { - "classmap": [ - "Mobile_Detect.php" - ], "psr-0": { "Detection": "namespaced/" - } + }, + "classmap": [ + "Mobile_Detect.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1134,34 +1067,82 @@ ], "support": { "issues": "https://github.com/serbanghita/Mobile-Detect/issues", - "source": "https://github.com/serbanghita/Mobile-Detect/tree/2.8.37" + "source": "https://github.com/serbanghita/Mobile-Detect/tree/2.8.39" }, - "funding": [ + "time": "2022-02-17T19:24:25+00:00" + }, + { + "name": "psr/cache", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ { - "url": "https://github.com/serbanghita", - "type": "github" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], - "time": "2021-02-19T21:22:57+00:00" + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "support": { + "source": "https://github.com/php-fig/cache/tree/3.0.0" + }, + "time": "2021-02-03T23:26:27+00:00" }, { "name": "psr/container", - "version": "1.1.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", "shasum": "" }, "require": { - "php": ">=7.2.0" + "php": ">=7.4.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -1188,9 +1169,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.1" + "source": "https://github.com/php-fig/container/tree/2.0.2" }, - "time": "2021-03-05T17:36:06+00:00" + "time": "2021-11-05T16:47:00+00:00" }, { "name": "psr/http-client", @@ -1468,30 +1449,30 @@ }, { "name": "psr/log", - "version": "1.1.4", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376", + "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\Log\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -1512,31 +1493,31 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" + "source": "https://github.com/php-fig/log/tree/2.0.0" }, - "time": "2021-05-03T11:20:27+00:00" + "time": "2021-07-14T16:41:46+00:00" }, { "name": "psr/simple-cache", - "version": "1.0.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/simple-cache.git", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" + "reference": "8707bf3cea6f710bf6ef05491234e3ab06f6432a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/8707bf3cea6f710bf6ef05491234e3ab06f6432a", + "reference": "8707bf3cea6f710bf6ef05491234e3ab06f6432a", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1551,7 +1532,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interfaces for simple caching", @@ -1563,30 +1544,30 @@ "simple-cache" ], "support": { - "source": "https://github.com/php-fig/simple-cache/tree/master" + "source": "https://github.com/php-fig/simple-cache/tree/2.0.0" }, - "time": "2017-10-23T01:57:42+00:00" + "time": "2021-10-29T13:22:09+00:00" }, { "name": "robmorgan/phinx", - "version": "0.12.8", + "version": "0.12.10", "source": { "type": "git", "url": "https://github.com/cakephp/phinx.git", - "reference": "d2ed1b452cc90f4cae4ea6b5976b94fb9e5ed2a2" + "reference": "ad056cff354fc67fedf9bf96c441c2b428afad0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/phinx/zipball/d2ed1b452cc90f4cae4ea6b5976b94fb9e5ed2a2", - "reference": "d2ed1b452cc90f4cae4ea6b5976b94fb9e5ed2a2", + "url": "https://api.github.com/repos/cakephp/phinx/zipball/ad056cff354fc67fedf9bf96c441c2b428afad0c", + "reference": "ad056cff354fc67fedf9bf96c441c2b428afad0c", "shasum": "" }, "require": { "cakephp/database": "^4.0", "php": ">=7.2", "psr/container": "^1.0 || ^2.0", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/console": "^3.4|^4.0|^5.0" + "symfony/config": "^3.4|^4.0|^5.0|^6.0", + "symfony/console": "^3.4|^4.0|^5.0|^6.0" }, "require-dev": { "cakephp/cakephp-codesniffer": "^4.0", @@ -1649,41 +1630,40 @@ ], "support": { "issues": "https://github.com/cakephp/phinx/issues", - "source": "https://github.com/cakephp/phinx/tree/0.12.8" + "source": "https://github.com/cakephp/phinx/tree/0.12.10" }, - "time": "2021-07-28T15:31:39+00:00" + "time": "2022-01-21T19:53:14+00:00" }, { "name": "symfony/config", - "version": "v5.3.4", + "version": "v6.0.8", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "4268f3059c904c61636275182707f81645517a37" + "reference": "6ac50d559aa64c8e7b5b17640c46241e4accb487" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/4268f3059c904c61636275182707f81645517a37", - "reference": "4268f3059c904c61636275182707f81645517a37", + "url": "https://api.github.com/repos/symfony/config/zipball/6ac50d559aa64c8e7b5b17640c46241e4accb487", + "reference": "6ac50d559aa64c8e7b5b17640c46241e4accb487", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/filesystem": "^4.4|^5.0", + "php": ">=8.0.2", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/filesystem": "^5.4|^6.0", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-php80": "^1.16", "symfony/polyfill-php81": "^1.22" }, "conflict": { "symfony/finder": "<4.4" }, "require-dev": { - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/finder": "^4.4|^5.0", - "symfony/messenger": "^4.4|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/yaml": "^4.4|^5.0" + "symfony/event-dispatcher": "^5.4|^6.0", + "symfony/finder": "^5.4|^6.0", + "symfony/messenger": "^5.4|^6.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/yaml": "^5.4|^6.0" }, "suggest": { "symfony/yaml": "To use the yaml reference dumper" @@ -1714,7 +1694,7 @@ "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/config/tree/v5.3.4" + "source": "https://github.com/symfony/config/tree/v6.0.8" }, "funding": [ { @@ -1730,50 +1710,46 @@ "type": "tidelift" } ], - "time": "2021-07-21T12:40:44+00:00" + "time": "2022-04-12T16:11:42+00:00" }, { "name": "symfony/console", - "version": "v5.3.7", + "version": "v6.0.8", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "8b1008344647462ae6ec57559da166c2bfa5e16a" + "reference": "0d00aa289215353aa8746a31d101f8e60826285c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/8b1008344647462ae6ec57559da166c2bfa5e16a", - "reference": "8b1008344647462ae6ec57559da166c2bfa5e16a", + "url": "https://api.github.com/repos/symfony/console/zipball/0d00aa289215353aa8746a31d101f8e60826285c", + "reference": "0d00aa289215353aa8746a31d101f8e60826285c", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", + "php": ">=8.0.2", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2", - "symfony/string": "^5.1" + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.4|^6.0" }, "conflict": { - "psr/log": ">=3", - "symfony/dependency-injection": "<4.4", - "symfony/dotenv": "<5.1", - "symfony/event-dispatcher": "<4.4", - "symfony/lock": "<4.4", - "symfony/process": "<4.4" + "symfony/dependency-injection": "<5.4", + "symfony/dotenv": "<5.4", + "symfony/event-dispatcher": "<5.4", + "symfony/lock": "<5.4", + "symfony/process": "<5.4" }, "provide": { - "psr/log-implementation": "1.0|2.0" + "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { - "psr/log": "^1|^2", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/event-dispatcher": "^5.4|^6.0", + "symfony/lock": "^5.4|^6.0", + "symfony/process": "^5.4|^6.0", + "symfony/var-dumper": "^5.4|^6.0" }, "suggest": { "psr/log": "For using the console logger", @@ -1813,7 +1789,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.3.7" + "source": "https://github.com/symfony/console/tree/v6.0.8" }, "funding": [ { @@ -1829,29 +1805,29 @@ "type": "tidelift" } ], - "time": "2021-08-25T20:02:16+00:00" + "time": "2022-04-20T15:01:42+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.4.0", + "version": "v3.0.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627" + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.0.2" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -1880,7 +1856,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.1" }, "funding": [ { @@ -1896,26 +1872,26 @@ "type": "tidelift" } ], - "time": "2021-03-23T23:28:01+00:00" + "time": "2022-01-02T09:55:41+00:00" }, { "name": "symfony/filesystem", - "version": "v5.3.4", + "version": "v6.0.7", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "343f4fe324383ca46792cae728a3b6e2f708fb32" + "reference": "6c9e4c41f2c51dfde3db298594ed9cba55dbf5ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/343f4fe324383ca46792cae728a3b6e2f708fb32", - "reference": "343f4fe324383ca46792cae728a3b6e2f708fb32", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/6c9e4c41f2c51dfde3db298594ed9cba55dbf5ff", + "reference": "6c9e4c41f2c51dfde3db298594ed9cba55dbf5ff", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.0.2", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-php80": "^1.16" + "symfony/polyfill-mbstring": "~1.8" }, "type": "library", "autoload": { @@ -1943,7 +1919,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.3.4" + "source": "https://github.com/symfony/filesystem/tree/v6.0.7" }, "funding": [ { @@ -1959,25 +1935,28 @@ "type": "tidelift" } ], - "time": "2021-07-21T12:40:44+00:00" + "time": "2022-04-01T12:54:51+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.23.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + "reference": "30885182c981ab175d4d034db0f6f469898070ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-ctype": "*" + }, "suggest": { "ext-ctype": "For best performance" }, @@ -1992,12 +1971,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2022,7 +2001,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" }, "funding": [ { @@ -2038,20 +2017,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-10-20T20:35:02+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.23.1", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "16880ba9c5ebe3642d1995ab866db29270b36535" + "reference": "81b86b50cf841a64252b439e738e97f4a34e2783" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/16880ba9c5ebe3642d1995ab866db29270b36535", - "reference": "16880ba9c5ebe3642d1995ab866db29270b36535", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/81b86b50cf841a64252b439e738e97f4a34e2783", + "reference": "81b86b50cf841a64252b439e738e97f4a34e2783", "shasum": "" }, "require": { @@ -2071,12 +2050,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2103,7 +2082,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.25.0" }, "funding": [ { @@ -2119,11 +2098,11 @@ "type": "tidelift" } ], - "time": "2021-05-27T12:26:48+00:00" + "time": "2021-11-23T21:10:46+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.23.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", @@ -2152,12 +2131,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -2187,7 +2166,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.25.0" }, "funding": [ { @@ -2207,21 +2186,24 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.23.1", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6" + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-mbstring": "*" + }, "suggest": { "ext-mbstring": "For best performance" }, @@ -2236,12 +2218,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2267,7 +2249,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0" }, "funding": [ { @@ -2283,99 +2265,20 @@ "type": "tidelift" } ], - "time": "2021-05-27T12:26:48+00:00" + "time": "2021-11-30T18:21:41+00:00" }, { - "name": "symfony/polyfill-php73", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.23.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-02-19T12:13:01+00:00" - }, - { - "name": "symfony/polyfill-php80", - "version": "v1.23.1", + "name": "symfony/polyfill-php81", + "version": "v1.25.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be" + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/5de4ba2d41b15f9bd0e19b2ab9674135813ec98f", + "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f", "shasum": "" }, "require": { @@ -2392,95 +2295,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, "files": [ "bootstrap.php" ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-07-28T13:41:28+00:00" - }, - { - "name": "symfony/polyfill-php81", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "e66119f3de95efc359483f810c4c3e6436279436" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/e66119f3de95efc359483f810c4c3e6436279436", - "reference": "e66119f3de95efc359483f810c4c3e6436279436", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { "psr-4": { "Symfony\\Polyfill\\Php81\\": "" }, - "files": [ - "bootstrap.php" - ], "classmap": [ "Resources/stubs" ] @@ -2508,7 +2328,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.25.0" }, "funding": [ { @@ -2524,25 +2344,28 @@ "type": "tidelift" } ], - "time": "2021-05-21T13:25:03+00:00" + "time": "2021-09-13T13:58:11+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.4.0", + "version": "v3.0.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb" + "reference": "e517458f278c2131ca9f262f8fbaf01410f2c65c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/e517458f278c2131ca9f262f8fbaf01410f2c65c", + "reference": "e517458f278c2131ca9f262f8fbaf01410f2c65c", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.1" + "php": ">=8.0.2", + "psr/container": "^2.0" + }, + "conflict": { + "ext-psr": "<1.1|>=2" }, "suggest": { "symfony/service-implementation": "" @@ -2550,7 +2373,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -2587,7 +2410,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/service-contracts/tree/v3.0.1" }, "funding": [ { @@ -2603,44 +2426,46 @@ "type": "tidelift" } ], - "time": "2021-04-01T10:43:52+00:00" + "time": "2022-03-13T20:10:05+00:00" }, { "name": "symfony/string", - "version": "v5.3.7", + "version": "v6.0.8", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5" + "reference": "ac0aa5c2282e0de624c175b68d13f2c8f2e2649d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/8d224396e28d30f81969f083a58763b8b9ceb0a5", - "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5", + "url": "https://api.github.com/repos/symfony/string/zipball/ac0aa5c2282e0de624c175b68d13f2c8f2e2649d", + "reference": "ac0aa5c2282e0de624c175b68d13f2c8f2e2649d", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.0.2", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "~1.15" + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/translation-contracts": "<2.0" }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0", - "symfony/http-client": "^4.4|^5.0", - "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0" + "symfony/error-handler": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/translation-contracts": "^2.0|^3.0", + "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", "autoload": { - "psr-4": { - "Symfony\\Component\\String\\": "" - }, "files": [ "Resources/functions.php" ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, "exclude-from-classmap": [ "/Tests/" ] @@ -2670,7 +2495,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.3.7" + "source": "https://github.com/symfony/string/tree/v6.0.8" }, "funding": [ { @@ -2686,7 +2511,7 @@ "type": "tidelift" } ], - "time": "2021-08-26T08:00:08+00:00" + "time": "2022-04-22T08:18:02+00:00" } ], "packages-dev": [ @@ -2735,21 +2560,21 @@ }, { "name": "cakephp/bake", - "version": "2.5.2", + "version": "2.7.0", "source": { "type": "git", "url": "https://github.com/cakephp/bake.git", - "reference": "bfb856afcfbc70c5cf5341669c3036a45ca15d94" + "reference": "3933caa0941b2f75f3e53c5456efdbf588917584" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/bake/zipball/bfb856afcfbc70c5cf5341669c3036a45ca15d94", - "reference": "bfb856afcfbc70c5cf5341669c3036a45ca15d94", + "url": "https://api.github.com/repos/cakephp/bake/zipball/3933caa0941b2f75f3e53c5456efdbf588917584", + "reference": "3933caa0941b2f75f3e53c5456efdbf588917584", "shasum": "" }, "require": { "brick/varexporter": "^0.3.5", - "cakephp/cakephp": "^4.1", + "cakephp/cakephp": "^4.3.0", "cakephp/twig-view": "^1.0.2", "php": ">=7.2" }, @@ -2757,7 +2582,7 @@ "cakephp/cakephp-codesniffer": "^4.0", "cakephp/debug_kit": "^4.1", "cakephp/plugin-installer": "^1.3", - "phpunit/phpunit": "~8.5.0" + "phpunit/phpunit": "^8.5 || ^9.3" }, "type": "cakephp-plugin", "autoload": { @@ -2787,26 +2612,26 @@ "issues": "https://github.com/cakephp/bake/issues", "source": "https://github.com/cakephp/bake" }, - "time": "2021-07-26T14:56:18+00:00" + "time": "2022-04-14T08:50:07+00:00" }, { "name": "cakephp/cakephp-codesniffer", - "version": "4.2.4", + "version": "4.5.1", "source": { "type": "git", "url": "https://github.com/cakephp/cakephp-codesniffer.git", - "reference": "c5bb1faeebf09cd4a3604bdb0c84f7bc92dc5475" + "reference": "6b17905db024b8d7e64a15296688545c61ab6694" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/cakephp-codesniffer/zipball/c5bb1faeebf09cd4a3604bdb0c84f7bc92dc5475", - "reference": "c5bb1faeebf09cd4a3604bdb0c84f7bc92dc5475", + "url": "https://api.github.com/repos/cakephp/cakephp-codesniffer/zipball/6b17905db024b8d7e64a15296688545c61ab6694", + "reference": "6b17905db024b8d7e64a15296688545c61ab6694", "shasum": "" }, "require": { "php": ">=7.2.0", - "slevomat/coding-standard": "^6.3.6", - "squizlabs/php_codesniffer": "~3.5.5" + "slevomat/coding-standard": "^6.3.6 || ^7.0", + "squizlabs/php_codesniffer": "^3.6" }, "require-dev": { "phpunit/phpunit": "^7.1" @@ -2839,24 +2664,24 @@ "issues": "https://github.com/cakephp/cakephp-codesniffer/issues", "source": "https://github.com/cakephp/cakephp-codesniffer" }, - "time": "2020-12-03T20:39:38+00:00" + "time": "2021-07-11T04:47:47+00:00" }, { "name": "cakephp/debug_kit", - "version": "4.4.4", + "version": "4.7.1", "source": { "type": "git", "url": "https://github.com/cakephp/debug_kit.git", - "reference": "10d7d9ba36945844211f1d8763e59618917e1784" + "reference": "ce564bacca4ebf471c34a886741672b54328b382" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/debug_kit/zipball/10d7d9ba36945844211f1d8763e59618917e1784", - "reference": "10d7d9ba36945844211f1d8763e59618917e1784", + "url": "https://api.github.com/repos/cakephp/debug_kit/zipball/ce564bacca4ebf471c34a886741672b54328b382", + "reference": "ce564bacca4ebf471c34a886741672b54328b382", "shasum": "" }, "require": { - "cakephp/cakephp": "^4.2.0", + "cakephp/cakephp": "^4.3.0", "cakephp/chronos": "^2.0", "composer/composer": "^1.3 | ^2.0", "jdorn/sql-formatter": "^1.2", @@ -2905,7 +2730,7 @@ "issues": "https://github.com/cakephp/debug_kit/issues", "source": "https://github.com/cakephp/debug_kit" }, - "time": "2021-09-12T20:06:14+00:00" + "time": "2022-01-20T02:44:41+00:00" }, { "name": "cakephp/twig-view", @@ -2972,38 +2797,45 @@ }, { "name": "composer/composer", - "version": "2.1.9", + "version": "2.3.5", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "e558c88f28d102d497adec4852802c0dc14c7077" + "reference": "50c47b1f907cfcdb8f072b88164d22b527557ae1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/e558c88f28d102d497adec4852802c0dc14c7077", - "reference": "e558c88f28d102d497adec4852802c0dc14c7077", + "url": "https://api.github.com/repos/composer/composer/zipball/50c47b1f907cfcdb8f072b88164d22b527557ae1", + "reference": "50c47b1f907cfcdb8f072b88164d22b527557ae1", "shasum": "" }, "require": { "composer/ca-bundle": "^1.0", "composer/metadata-minifier": "^1.0", + "composer/pcre": "^2 || ^3", "composer/semver": "^3.0", "composer/spdx-licenses": "^1.2", - "composer/xdebug-handler": "^2.0", + "composer/xdebug-handler": "^2.0.2 || ^3.0.3", "justinrainbow/json-schema": "^5.2.11", - "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1.0", - "react/promise": "^1.2 || ^2.7", + "php": "^7.2.5 || ^8.0", + "psr/log": "^1.0 || ^2.0 || ^3.0", + "react/promise": "^2.8", "seld/jsonlint": "^1.4", - "seld/phar-utils": "^1.0", - "symfony/console": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0", - "symfony/filesystem": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0", - "symfony/finder": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0", - "symfony/process": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0" + "seld/phar-utils": "^1.2", + "symfony/console": "^5.4.1 || ^6.0", + "symfony/filesystem": "^5.4 || ^6.0", + "symfony/finder": "^5.4 || ^6.0", + "symfony/polyfill-php73": "^1.24", + "symfony/polyfill-php80": "^1.24", + "symfony/process": "^5.4 || ^6.0" }, "require-dev": { - "phpspec/prophecy": "^1.10", - "symfony/phpunit-bridge": "^4.2 || ^5.0 || ^6.0" + "phpstan/phpstan": "^1.4.1", + "phpstan/phpstan-deprecation-rules": "^1", + "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan-strict-rules": "^1", + "phpstan/phpstan-symfony": "^1.1", + "symfony/phpunit-bridge": "^6.0" }, "suggest": { "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", @@ -3016,7 +2848,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-main": "2.3-dev" } }, "autoload": { @@ -3037,20 +2869,89 @@ { "name": "Jordi Boggiano", "email": "j.boggiano@seld.be", - "homepage": "https://seld.be" + "homepage": "https://seld.be" + } + ], + "description": "Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.", + "homepage": "https://getcomposer.org/", + "keywords": [ + "autoload", + "dependency", + "package" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/composer/issues", + "source": "https://github.com/composer/composer/tree/2.3.5" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-04-13T14:43:00+00:00" + }, + { + "name": "composer/metadata-minifier", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/composer/metadata-minifier.git", + "reference": "c549d23829536f0d0e984aaabbf02af91f443207" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/metadata-minifier/zipball/c549d23829536f0d0e984aaabbf02af91f443207", + "reference": "c549d23829536f0d0e984aaabbf02af91f443207", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "composer/composer": "^2", + "phpstan/phpstan": "^0.12.55", + "symfony/phpunit-bridge": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\MetadataMinifier\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" } ], - "description": "Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.", - "homepage": "https://getcomposer.org/", + "description": "Small utility library that handles metadata minification and expansion.", "keywords": [ - "autoload", - "dependency", - "package" + "composer", + "compression" ], "support": { - "irc": "ircs://irc.libera.chat:6697/composer", - "issues": "https://github.com/composer/composer/issues", - "source": "https://github.com/composer/composer/tree/2.1.9" + "issues": "https://github.com/composer/metadata-minifier/issues", + "source": "https://github.com/composer/metadata-minifier/tree/1.0.0" }, "funding": [ { @@ -3066,39 +2967,39 @@ "type": "tidelift" } ], - "time": "2021-10-05T07:47:38+00:00" + "time": "2021-04-07T13:37:33+00:00" }, { - "name": "composer/metadata-minifier", - "version": "1.0.0", + "name": "composer/pcre", + "version": "3.0.0", "source": { "type": "git", - "url": "https://github.com/composer/metadata-minifier.git", - "reference": "c549d23829536f0d0e984aaabbf02af91f443207" + "url": "https://github.com/composer/pcre.git", + "reference": "e300eb6c535192decd27a85bc72a9290f0d6b3bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/metadata-minifier/zipball/c549d23829536f0d0e984aaabbf02af91f443207", - "reference": "c549d23829536f0d0e984aaabbf02af91f443207", + "url": "https://api.github.com/repos/composer/pcre/zipball/e300eb6c535192decd27a85bc72a9290f0d6b3bd", + "reference": "e300eb6c535192decd27a85bc72a9290f0d6b3bd", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0 || ^8.0" + "php": "^7.4 || ^8.0" }, "require-dev": { - "composer/composer": "^2", - "phpstan/phpstan": "^0.12.55", - "symfony/phpunit-bridge": "^4.2 || ^5" + "phpstan/phpstan": "^1.3", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^5" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.x-dev" + "dev-main": "3.x-dev" } }, "autoload": { "psr-4": { - "Composer\\MetadataMinifier\\": "src" + "Composer\\Pcre\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -3112,14 +3013,16 @@ "homepage": "http://seld.be" } ], - "description": "Small utility library that handles metadata minification and expansion.", + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", "keywords": [ - "composer", - "compression" + "PCRE", + "preg", + "regex", + "regular expression" ], "support": { - "issues": "https://github.com/composer/metadata-minifier/issues", - "source": "https://github.com/composer/metadata-minifier/tree/1.0.0" + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/3.0.0" }, "funding": [ { @@ -3135,27 +3038,27 @@ "type": "tidelift" } ], - "time": "2021-04-07T13:37:33+00:00" + "time": "2022-02-25T20:21:48+00:00" }, { "name": "composer/semver", - "version": "3.2.5", + "version": "3.3.2", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "31f3ea725711245195f62e54ffa402d8ef2fdba9" + "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/31f3ea725711245195f62e54ffa402d8ef2fdba9", - "reference": "31f3ea725711245195f62e54ffa402d8ef2fdba9", + "url": "https://api.github.com/repos/composer/semver/zipball/3953f23262f2bff1919fc82183ad9acb13ff62c9", + "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^0.12.54", + "phpstan/phpstan": "^1.4", "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", @@ -3200,7 +3103,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.2.5" + "source": "https://github.com/composer/semver/tree/3.3.2" }, "funding": [ { @@ -3216,27 +3119,28 @@ "type": "tidelift" } ], - "time": "2021-05-24T12:41:47+00:00" + "time": "2022-04-01T19:23:25+00:00" }, { "name": "composer/spdx-licenses", - "version": "1.5.5", + "version": "1.5.6", "source": { "type": "git", "url": "https://github.com/composer/spdx-licenses.git", - "reference": "de30328a7af8680efdc03e396aad24befd513200" + "reference": "a30d487169d799745ca7280bc90fdfa693536901" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/de30328a7af8680efdc03e396aad24befd513200", - "reference": "de30328a7af8680efdc03e396aad24befd513200", + "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/a30d487169d799745ca7280bc90fdfa693536901", + "reference": "a30d487169d799745ca7280bc90fdfa693536901", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 7" + "phpstan/phpstan": "^0.12.55", + "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", "extra": { @@ -3279,7 +3183,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/spdx-licenses/issues", - "source": "https://github.com/composer/spdx-licenses/tree/1.5.5" + "source": "https://github.com/composer/spdx-licenses/tree/1.5.6" }, "funding": [ { @@ -3295,29 +3199,31 @@ "type": "tidelift" } ], - "time": "2020-12-03T16:04:16+00:00" + "time": "2021-11-18T10:14:14+00:00" }, { "name": "composer/xdebug-handler", - "version": "2.0.2", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "84674dd3a7575ba617f5a76d7e9e29a7d3891339" + "reference": "ced299686f41dce890debac69273b47ffe98a40c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/84674dd3a7575ba617f5a76d7e9e29a7d3891339", - "reference": "84674dd3a7575ba617f5a76d7e9e29a7d3891339", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/ced299686f41dce890debac69273b47ffe98a40c", + "reference": "ced299686f41dce890debac69273b47ffe98a40c", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0 || ^8.0", + "composer/pcre": "^1 || ^2 || ^3", + "php": "^7.2.5 || ^8.0", "psr/log": "^1 || ^2 || ^3" }, "require-dev": { - "phpstan/phpstan": "^0.12.55", - "symfony/phpunit-bridge": "^4.2 || ^5" + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^6.0" }, "type": "library", "autoload": { @@ -3343,7 +3249,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/2.0.2" + "source": "https://github.com/composer/xdebug-handler/tree/3.0.3" }, "funding": [ { @@ -3359,31 +3265,31 @@ "type": "tidelift" } ], - "time": "2021-07-31T17:03:58+00:00" + "time": "2022-02-25T21:32:43+00:00" }, { "name": "dealerdirect/phpcodesniffer-composer-installer", - "version": "v0.7.1", + "version": "v0.7.2", "source": { "type": "git", "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", - "reference": "fe390591e0241955f22eb9ba327d137e501c771c" + "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/fe390591e0241955f22eb9ba327d137e501c771c", - "reference": "fe390591e0241955f22eb9ba327d137e501c771c", + "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", + "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", "shasum": "" }, "require": { "composer-plugin-api": "^1.0 || ^2.0", "php": ">=5.3", - "squizlabs/php_codesniffer": "^2.0 || ^3.0 || ^4.0" + "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" }, "require-dev": { "composer/composer": "*", - "phpcompatibility/php-compatibility": "^9.0", - "sensiolabs/security-checker": "^4.1.0" + "php-parallel-lint/php-parallel-lint": "^1.3.1", + "phpcompatibility/php-compatibility": "^9.0" }, "type": "composer-plugin", "extra": { @@ -3404,6 +3310,10 @@ "email": "franck.nijhof@dealerdirect.com", "homepage": "http://www.frenck.nl", "role": "Developer / IT Manager" + }, + { + "name": "Contributors", + "homepage": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer/graphs/contributors" } ], "description": "PHP_CodeSniffer Standards Composer Installer Plugin", @@ -3415,6 +3325,7 @@ "codesniffer", "composer", "installer", + "phpcbf", "phpcs", "plugin", "qa", @@ -3429,33 +3340,34 @@ "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues", "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer" }, - "time": "2020-12-07T18:04:37+00:00" + "time": "2022-02-04T12:51:07+00:00" }, { "name": "doctrine/instantiator", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^8.0", + "doctrine/coding-standard": "^9", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" }, "type": "library", "autoload": { @@ -3482,7 +3394,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.0" + "source": "https://github.com/doctrine/instantiator/tree/1.4.1" }, "funding": [ { @@ -3498,7 +3410,7 @@ "type": "tidelift" } ], - "time": "2020-11-10T18:47:58+00:00" + "time": "2022-03-03T08:28:38+00:00" }, { "name": "jasny/twig-extensions", @@ -3677,16 +3589,16 @@ }, { "name": "justinrainbow/json-schema", - "version": "5.2.11", + "version": "5.2.12", "source": { "type": "git", "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "2ab6744b7296ded80f8cc4f9509abbff393399aa" + "reference": "ad87d5a5ca981228e0e205c2bc7dfb8e24559b60" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/2ab6744b7296ded80f8cc4f9509abbff393399aa", - "reference": "2ab6744b7296ded80f8cc4f9509abbff393399aa", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/ad87d5a5ca981228e0e205c2bc7dfb8e24559b60", + "reference": "ad87d5a5ca981228e0e205c2bc7dfb8e24559b60", "shasum": "" }, "require": { @@ -3741,9 +3653,9 @@ ], "support": { "issues": "https://github.com/justinrainbow/json-schema/issues", - "source": "https://github.com/justinrainbow/json-schema/tree/5.2.11" + "source": "https://github.com/justinrainbow/json-schema/tree/5.2.12" }, - "time": "2021-07-22T09:24:00+00:00" + "time": "2022-04-13T08:02:27+00:00" }, { "name": "m1/env", @@ -3809,37 +3721,38 @@ }, { "name": "myclabs/deep-copy", - "version": "1.10.2", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, - "replace": { - "myclabs/deep-copy": "self.version" + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" }, "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, "files": [ "src/DeepCopy/deep_copy.php" - ] + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3855,7 +3768,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" }, "funding": [ { @@ -3863,20 +3776,20 @@ "type": "tidelift" } ], - "time": "2020-11-13T09:40:50+00:00" + "time": "2022-03-03T13:19:32+00:00" }, { "name": "nikic/php-parser", - "version": "v4.13.0", + "version": "v4.13.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "50953a2691a922aa1769461637869a0a2faa3f53" + "reference": "210577fe3cf7badcc5814d99455df46564f3c077" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/50953a2691a922aa1769461637869a0a2faa3f53", - "reference": "50953a2691a922aa1769461637869a0a2faa3f53", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", + "reference": "210577fe3cf7badcc5814d99455df46564f3c077", "shasum": "" }, "require": { @@ -3917,9 +3830,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" }, - "time": "2021-09-20T12:20:58+00:00" + "time": "2021-11-30T19:35:32+00:00" }, { "name": "phar-io/manifest", @@ -3983,16 +3896,16 @@ }, { "name": "phar-io/version", - "version": "3.1.0", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "bae7c545bef187884426f042434e561ab1ddb182" + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", - "reference": "bae7c545bef187884426f042434e561ab1ddb182", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { @@ -4028,9 +3941,9 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.1.0" + "source": "https://github.com/phar-io/version/tree/3.2.1" }, - "time": "2021-02-23T14:00:09+00:00" + "time": "2022-02-21T01:04:05+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -4087,16 +4000,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.2.2", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", "shasum": "" }, "require": { @@ -4107,7 +4020,8 @@ "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "~1.3.2" + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -4137,22 +4051,22 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" }, - "time": "2020-09-03T19:13:55+00:00" + "time": "2021-10-19T17:43:47+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.5.1", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae" + "reference": "77a32518733312af16a44300404e945338981de3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", + "reference": "77a32518733312af16a44300404e945338981de3", "shasum": "" }, "require": { @@ -4187,22 +4101,22 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1" }, - "time": "2021-10-02T14:08:47+00:00" + "time": "2022-03-15T21:29:03+00:00" }, { "name": "phpspec/prophecy", - "version": "1.14.0", + "version": "v1.15.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e" + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", - "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", "shasum": "" }, "require": { @@ -4254,45 +4168,36 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.14.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" }, - "time": "2021-09-10T09:02:12+00:00" + "time": "2021-12-08T12:19:24+00:00" }, { "name": "phpstan/phpdoc-parser", - "version": "0.4.9", + "version": "1.5.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "98a088b17966bdf6ee25c8a4b634df313d8aa531" + "reference": "981cc368a216c988e862a75e526b6076987d1b50" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/98a088b17966bdf6ee25c8a4b634df313d8aa531", - "reference": "98a088b17966bdf6ee25c8a4b634df313d8aa531", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/981cc368a216c988e862a75e526b6076987d1b50", + "reference": "981cc368a216c988e862a75e526b6076987d1b50", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^7.2 || ^8.0" }, "require-dev": { - "consistence/coding-standard": "^3.5", - "ergebnis/composer-normalize": "^2.0.2", - "jakub-onderka/php-parallel-lint": "^0.9.2", - "phing/phing": "^2.16.0", + "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.12.26", - "phpstan/phpstan-strict-rules": "^0.12", - "phpunit/phpunit": "^6.3", - "slevomat/coding-standard": "^4.7.2", - "symfony/process": "^4.0" + "phpstan/phpstan": "^1.5", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5", + "symfony/process": "^5.2" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.4-dev" - } - }, "autoload": { "psr-4": { "PHPStan\\PhpDocParser\\": [ @@ -4307,29 +4212,29 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/master" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.5.1" }, - "time": "2020-08-03T20:32:43+00:00" + "time": "2022-05-05T11:32:40+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.7", + "version": "9.2.15", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218" + "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d4c798ed8d51506800b441f7a13ecb0f76f12218", - "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f", + "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.12.0", + "nikic/php-parser": "^4.13.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -4378,7 +4283,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.7" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15" }, "funding": [ { @@ -4386,20 +4291,20 @@ "type": "github" } ], - "time": "2021-09-17T05:39:03+00:00" + "time": "2022-03-07T09:28:20+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.5", + "version": "3.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8" + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/aa4be8575f26070b100fccb67faabb28f21f66f8", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", "shasum": "" }, "require": { @@ -4438,7 +4343,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.5" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" }, "funding": [ { @@ -4446,7 +4351,7 @@ "type": "github" } ], - "time": "2020-09-28T05:57:25+00:00" + "time": "2021-12-02T12:48:52+00:00" }, { "name": "phpunit/php-invoker", @@ -4631,16 +4536,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.10", + "version": "9.5.20", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a" + "reference": "12bc8879fb65aef2138b26fc633cb1e3620cffba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c814a05837f2edb0d1471d6e3f4ab3501ca3899a", - "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/12bc8879fb65aef2138b26fc633cb1e3620cffba", + "reference": "12bc8879fb65aef2138b26fc633cb1e3620cffba", "shasum": "" }, "require": { @@ -4656,7 +4561,7 @@ "phar-io/version": "^3.0.2", "php": ">=7.3", "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2.7", + "phpunit/php-code-coverage": "^9.2.13", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -4670,7 +4575,7 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3.4", + "sebastian/type": "^3.0", "sebastian/version": "^3.0.2" }, "require-dev": { @@ -4691,11 +4596,11 @@ } }, "autoload": { - "classmap": [ - "src/" - ], "files": [ "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -4718,11 +4623,11 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.10" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.20" }, "funding": [ { - "url": "https://phpunit.de/donate.html", + "url": "https://phpunit.de/sponsors.html", "type": "custom" }, { @@ -4730,40 +4635,41 @@ "type": "github" } ], - "time": "2021-09-25T07:38:51+00:00" + "time": "2022-04-01T12:37:26+00:00" }, { "name": "psy/psysh", - "version": "v0.10.9", + "version": "v0.11.4", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "01281336c4ae557fe4a994544f30d3a1bc204375" + "reference": "05c544b339b112226ad14803e1e5b09a61957454" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/01281336c4ae557fe4a994544f30d3a1bc204375", - "reference": "01281336c4ae557fe4a994544f30d3a1bc204375", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/05c544b339b112226ad14803e1e5b09a61957454", + "reference": "05c544b339b112226ad14803e1e5b09a61957454", "shasum": "" }, "require": { "ext-json": "*", "ext-tokenizer": "*", - "nikic/php-parser": "~4.0|~3.0|~2.0|~1.3", - "php": "^8.0 || ^7.0 || ^5.5.9", - "symfony/console": "~5.0|~4.0|~3.0|^2.4.2|~2.3.10", - "symfony/var-dumper": "~5.0|~4.0|~3.0|~2.7" + "nikic/php-parser": "^4.0 || ^3.1", + "php": "^8.0 || ^7.0.8", + "symfony/console": "^6.0 || ^5.0 || ^4.0 || ^3.4", + "symfony/var-dumper": "^6.0 || ^5.0 || ^4.0 || ^3.4" + }, + "conflict": { + "symfony/console": "4.4.37 || 5.3.14 || 5.3.15 || 5.4.3 || 5.4.4 || 6.0.3 || 6.0.4" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.2", - "hoa/console": "3.17.*" + "bamarni/composer-bin-plugin": "^1.2" }, "suggest": { "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)", "ext-pdo-sqlite": "The doc command requires SQLite to work.", "ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.", - "ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history.", - "hoa/console": "A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit." + "ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history." }, "bin": [ "bin/psysh" @@ -4771,7 +4677,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "0.10.x-dev" + "dev-main": "0.11.x-dev" } }, "autoload": { @@ -4803,38 +4709,38 @@ ], "support": { "issues": "https://github.com/bobthecow/psysh/issues", - "source": "https://github.com/bobthecow/psysh/tree/v0.10.9" + "source": "https://github.com/bobthecow/psysh/tree/v0.11.4" }, - "time": "2021-10-10T13:37:39+00:00" + "time": "2022-05-06T12:49:14+00:00" }, { "name": "react/promise", - "version": "v2.8.0", + "version": "v2.9.0", "source": { "type": "git", "url": "https://github.com/reactphp/promise.git", - "reference": "f3cff96a19736714524ca0dd1d4130de73dbbbc4" + "reference": "234f8fd1023c9158e2314fa9d7d0e6a83db42910" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise/zipball/f3cff96a19736714524ca0dd1d4130de73dbbbc4", - "reference": "f3cff96a19736714524ca0dd1d4130de73dbbbc4", + "url": "https://api.github.com/repos/reactphp/promise/zipball/234f8fd1023c9158e2314fa9d7d0e6a83db42910", + "reference": "234f8fd1023c9158e2314fa9d7d0e6a83db42910", "shasum": "" }, "require": { "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "^7.0 || ^6.5 || ^5.7 || ^4.8.36" + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.36" }, "type": "library", "autoload": { - "psr-4": { - "React\\Promise\\": "src/" - }, "files": [ "src/functions_include.php" - ] + ], + "psr-4": { + "React\\Promise\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -4843,7 +4749,23 @@ "authors": [ { "name": "Jan Sorgalla", - "email": "jsorgalla@gmail.com" + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" } ], "description": "A lightweight implementation of CommonJS Promises/A for PHP", @@ -4853,9 +4775,19 @@ ], "support": { "issues": "https://github.com/reactphp/promise/issues", - "source": "https://github.com/reactphp/promise/tree/v2.8.0" + "source": "https://github.com/reactphp/promise/tree/v2.9.0" }, - "time": "2020-05-12T15:16:56+00:00" + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-02-11T10:27:51+00:00" }, { "name": "sebastian/cli-parser", @@ -5223,16 +5155,16 @@ }, { "name": "sebastian/environment", - "version": "5.1.3", + "version": "5.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac" + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", "shasum": "" }, "require": { @@ -5274,7 +5206,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.3" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" }, "funding": [ { @@ -5282,20 +5214,20 @@ "type": "github" } ], - "time": "2020-09-28T05:52:38+00:00" + "time": "2022-04-03T09:37:03+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.3", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65" + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d89cc98761b8cb5a1a235a6b703ae50d34080e65", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", "shasum": "" }, "require": { @@ -5344,14 +5276,14 @@ } ], "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", + "homepage": "https://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.3" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" }, "funding": [ { @@ -5359,20 +5291,20 @@ "type": "github" } ], - "time": "2020-09-28T05:24:23+00:00" + "time": "2021-11-11T14:18:36+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.3", + "version": "5.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49" + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", "shasum": "" }, "require": { @@ -5415,7 +5347,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" }, "funding": [ { @@ -5423,7 +5355,7 @@ "type": "github" } ], - "time": "2021-06-11T13:31:12+00:00" + "time": "2022-02-14T08:28:10+00:00" }, { "name": "sebastian/lines-of-code", @@ -5714,28 +5646,28 @@ }, { "name": "sebastian/type", - "version": "2.3.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" + "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", + "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", "shasum": "" }, "require": { "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -5758,7 +5690,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" + "source": "https://github.com/sebastianbergmann/type/tree/3.0.0" }, "funding": [ { @@ -5766,7 +5698,7 @@ "type": "github" } ], - "time": "2021-06-15T12:49:02+00:00" + "time": "2022-03-15T09:54:48+00:00" }, { "name": "sebastian/version", @@ -5823,23 +5755,24 @@ }, { "name": "seld/jsonlint", - "version": "1.8.3", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "9ad6ce79c342fbd44df10ea95511a1b24dee5b57" + "reference": "4211420d25eba80712bff236a98960ef68b866b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/9ad6ce79c342fbd44df10ea95511a1b24dee5b57", - "reference": "9ad6ce79c342fbd44df10ea95511a1b24dee5b57", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/4211420d25eba80712bff236a98960ef68b866b7", + "reference": "4211420d25eba80712bff236a98960ef68b866b7", "shasum": "" }, "require": { "php": "^5.3 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^8.5.13" }, "bin": [ "bin/jsonlint" @@ -5870,7 +5803,7 @@ ], "support": { "issues": "https://github.com/Seldaek/jsonlint/issues", - "source": "https://github.com/Seldaek/jsonlint/tree/1.8.3" + "source": "https://github.com/Seldaek/jsonlint/tree/1.9.0" }, "funding": [ { @@ -5882,20 +5815,20 @@ "type": "tidelift" } ], - "time": "2020-11-11T09:19:24+00:00" + "time": "2022-04-01T13:37:23+00:00" }, { "name": "seld/phar-utils", - "version": "1.1.2", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/Seldaek/phar-utils.git", - "reference": "749042a2315705d2dfbbc59234dd9ceb22bf3ff0" + "reference": "9f3452c93ff423469c0d56450431562ca423dcee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/749042a2315705d2dfbbc59234dd9ceb22bf3ff0", - "reference": "749042a2315705d2dfbbc59234dd9ceb22bf3ff0", + "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/9f3452c93ff423469c0d56450431562ca423dcee", + "reference": "9f3452c93ff423469c0d56450431562ca423dcee", "shasum": "" }, "require": { @@ -5928,43 +5861,43 @@ ], "support": { "issues": "https://github.com/Seldaek/phar-utils/issues", - "source": "https://github.com/Seldaek/phar-utils/tree/1.1.2" + "source": "https://github.com/Seldaek/phar-utils/tree/1.2.0" }, - "time": "2021-08-19T21:01:38+00:00" + "time": "2021-12-10T11:20:11+00:00" }, { "name": "slevomat/coding-standard", - "version": "6.4.1", + "version": "7.2.0", "source": { "type": "git", "url": "https://github.com/slevomat/coding-standard.git", - "reference": "696dcca217d0c9da2c40d02731526c1e25b65346" + "reference": "b4f96a8beea515d2d89141b7b9ad72f526d84071" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/696dcca217d0c9da2c40d02731526c1e25b65346", - "reference": "696dcca217d0c9da2c40d02731526c1e25b65346", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/b4f96a8beea515d2d89141b7b9ad72f526d84071", + "reference": "b4f96a8beea515d2d89141b7b9ad72f526d84071", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7", - "php": "^7.1 || ^8.0", - "phpstan/phpdoc-parser": "0.4.5 - 0.4.9", - "squizlabs/php_codesniffer": "^3.5.6" + "php": "^7.2 || ^8.0", + "phpstan/phpdoc-parser": "^1.5.1", + "squizlabs/php_codesniffer": "^3.6.2" }, "require-dev": { - "phing/phing": "2.16.3", - "php-parallel-lint/php-parallel-lint": "1.2.0", - "phpstan/phpstan": "0.12.48", - "phpstan/phpstan-deprecation-rules": "0.12.5", - "phpstan/phpstan-phpunit": "0.12.16", - "phpstan/phpstan-strict-rules": "0.12.5", - "phpunit/phpunit": "7.5.20|8.5.5|9.4.0" + "phing/phing": "2.17.3", + "php-parallel-lint/php-parallel-lint": "1.3.2", + "phpstan/phpstan": "1.4.10|1.6.7", + "phpstan/phpstan-deprecation-rules": "1.0.0", + "phpstan/phpstan-phpunit": "1.0.0|1.1.1", + "phpstan/phpstan-strict-rules": "1.2.3", + "phpunit/phpunit": "7.5.20|8.5.21|9.5.20" }, "type": "phpcodesniffer-standard", "extra": { "branch-alias": { - "dev-master": "6.x-dev" + "dev-master": "7.x-dev" } }, "autoload": { @@ -5979,7 +5912,7 @@ "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", "support": { "issues": "https://github.com/slevomat/coding-standard/issues", - "source": "https://github.com/slevomat/coding-standard/tree/6.4.1" + "source": "https://github.com/slevomat/coding-standard/tree/7.2.0" }, "funding": [ { @@ -5991,20 +5924,20 @@ "type": "tidelift" } ], - "time": "2020-10-05T12:39:37+00:00" + "time": "2022-05-06T10:58:42+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.5.8", + "version": "3.6.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "9d583721a7157ee997f235f327de038e7ea6dac4" + "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/9d583721a7157ee997f235f327de038e7ea6dac4", - "reference": "9d583721a7157ee997f235f327de038e7ea6dac4", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a", + "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a", "shasum": "" }, "require": { @@ -6047,25 +5980,24 @@ "source": "https://github.com/squizlabs/PHP_CodeSniffer", "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, - "time": "2020-10-23T02:01:07+00:00" + "time": "2021-12-12T21:44:58+00:00" }, { "name": "symfony/finder", - "version": "v5.3.7", + "version": "v6.0.8", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "a10000ada1e600d109a6c7632e9ac42e8bf2fb93" + "reference": "af7edab28d17caecd1f40a9219fc646ae751c21f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/a10000ada1e600d109a6c7632e9ac42e8bf2fb93", - "reference": "a10000ada1e600d109a6c7632e9ac42e8bf2fb93", + "url": "https://api.github.com/repos/symfony/finder/zipball/af7edab28d17caecd1f40a9219fc646ae751c21f", + "reference": "af7edab28d17caecd1f40a9219fc646ae751c21f", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.0.2" }, "type": "library", "autoload": { @@ -6093,7 +6025,169 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.3.7" + "source": "https://github.com/symfony/finder/tree/v6.0.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-04-15T08:07:58+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.25.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-06-05T21:20:04+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4407588e0d3f1f52efb65fbe92babe41f37fe50c", + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.25.0" }, "funding": [ { @@ -6109,25 +6203,24 @@ "type": "tidelift" } ], - "time": "2021-08-04T21:20:46+00:00" + "time": "2022-03-04T08:16:47+00:00" }, { "name": "symfony/process", - "version": "v5.3.7", + "version": "v6.0.8", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "38f26c7d6ed535217ea393e05634cb0b244a1967" + "reference": "d074154ea8b1443a96391f6e39f9e547b2dd01b9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/38f26c7d6ed535217ea393e05634cb0b244a1967", - "reference": "38f26c7d6ed535217ea393e05634cb0b244a1967", + "url": "https://api.github.com/repos/symfony/process/zipball/d074154ea8b1443a96391f6e39f9e547b2dd01b9", + "reference": "d074154ea8b1443a96391f6e39f9e547b2dd01b9", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.0.2" }, "type": "library", "autoload": { @@ -6155,7 +6248,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.3.7" + "source": "https://github.com/symfony/process/tree/v6.0.8" }, "funding": [ { @@ -6171,35 +6264,35 @@ "type": "tidelift" } ], - "time": "2021-08-04T21:20:46+00:00" + "time": "2022-04-12T16:11:42+00:00" }, { "name": "symfony/var-dumper", - "version": "v5.3.8", + "version": "v6.0.8", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "eaaea4098be1c90c8285543e1356a09c8aa5c8da" + "reference": "fa61dfb4bd3068df2492013dc65f3190e9f550c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/eaaea4098be1c90c8285543e1356a09c8aa5c8da", - "reference": "eaaea4098be1c90c8285543e1356a09c8aa5c8da", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/fa61dfb4bd3068df2492013dc65f3190e9f550c0", + "reference": "fa61dfb4bd3068df2492013dc65f3190e9f550c0", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.0.2", + "symfony/polyfill-mbstring": "~1.0" }, "conflict": { "phpunit/phpunit": "<5.4.3", - "symfony/console": "<4.4" + "symfony/console": "<5.4" }, "require-dev": { "ext-iconv": "*", - "symfony/console": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", + "symfony/console": "^5.4|^6.0", + "symfony/process": "^5.4|^6.0", + "symfony/uid": "^5.4|^6.0", "twig/twig": "^2.13|^3.0.4" }, "suggest": { @@ -6243,7 +6336,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v5.3.8" + "source": "https://github.com/symfony/var-dumper/tree/v6.0.8" }, "funding": [ { @@ -6259,7 +6352,7 @@ "type": "tidelift" } ], - "time": "2021-09-24T15:59:58+00:00" + "time": "2022-04-26T13:22:23+00:00" }, { "name": "theseer/tokenizer", @@ -6313,25 +6406,25 @@ }, { "name": "twig/markdown-extra", - "version": "v3.3.3", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/twigphp/markdown-extra.git", - "reference": "725a4ef89d93bb80fc63c67cf261bf7512649290" + "reference": "25ed505b6ffd3b00f922ca682489dfbaf44eb1f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/markdown-extra/zipball/725a4ef89d93bb80fc63c67cf261bf7512649290", - "reference": "725a4ef89d93bb80fc63c67cf261bf7512649290", + "url": "https://api.github.com/repos/twigphp/markdown-extra/zipball/25ed505b6ffd3b00f922ca682489dfbaf44eb1f7", + "reference": "25ed505b6ffd3b00f922ca682489dfbaf44eb1f7", "shasum": "" }, "require": { "php": ">=7.1.3", - "twig/twig": "^2.4|^3.0" + "twig/twig": "^2.7|^3.0" }, "require-dev": { "erusev/parsedown": "^1.7", - "league/commonmark": "^1.0", + "league/commonmark": "^1.0|^2.0", "league/html-to-markdown": "^4.8|^5.0", "michelf/php-markdown": "^1.8", "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0" @@ -6370,7 +6463,7 @@ "twig" ], "support": { - "source": "https://github.com/twigphp/markdown-extra/tree/v3.3.3" + "source": "https://github.com/twigphp/markdown-extra/tree/v3.4.0" }, "funding": [ { @@ -6382,20 +6475,20 @@ "type": "tidelift" } ], - "time": "2021-07-07T07:08:18+00:00" + "time": "2022-01-29T15:34:05+00:00" }, { "name": "twig/twig", - "version": "v3.3.3", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "a27fa056df8a6384316288ca8b0fa3a35fdeb569" + "reference": "ed19f4bf9d19c4ef920b5d8243910bd32e85b9ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/a27fa056df8a6384316288ca8b0fa3a35fdeb569", - "reference": "a27fa056df8a6384316288ca8b0fa3a35fdeb569", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/ed19f4bf9d19c4ef920b5d8243910bd32e85b9ba", + "reference": "ed19f4bf9d19c4ef920b5d8243910bd32e85b9ba", "shasum": "" }, "require": { @@ -6410,7 +6503,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -6446,7 +6539,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.3.3" + "source": "https://github.com/twigphp/Twig/tree/v3.4.0" }, "funding": [ { @@ -6458,7 +6551,7 @@ "type": "tidelift" } ], - "time": "2021-09-17T08:44:23+00:00" + "time": "2022-05-15T06:25:28+00:00" }, { "name": "webmozart/assert", @@ -6527,8 +6620,8 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": ">=7.2" + "php": ">=8.0" }, "platform-dev": [], - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.3.0" } diff --git a/app/config/routes.php b/app/config/routes.php index 4fbe6834..bbebfdf1 100644 --- a/app/config/routes.php +++ b/app/config/routes.php @@ -47,6 +47,54 @@ /** @var \Cake\Routing\RouteBuilder $routes */ $routes->setRouteClass(DashedRoute::class); +// Registry API routes + +//// API routes +$routes->scope('/api/v2', function (RouteBuilder $builder) { + // Register scoped middleware for in scopes. + $builder->registerMiddleware('csrf', new CsrfProtectionMiddleware(['httponly' => true])); + // BodyParserMiddleware will automatically parse JSON bodies, but we only + // want that for API transactions, so we only apply it to the /api scope. + $builder->registerMiddleware('bodyparser', new BodyParserMiddleware()); + /* + * Apply a middleware to the current route scope. + * Requires middleware to be registered through `Application::routes()` with `registerMiddleware()` + */ + $builder->applyMiddleware('csrf'); + $builder->setExtensions(['json']); + $builder->applyMiddleware('bodyparser'); + // Use setPass to make parameter show up as function parameter + // Model specific actions, which will usually have more specific URLs: + $builder->post( + '/api_users/generate/{id}', + ['controller' => 'ApiV2', 'action' => 'generateApiKey', 'model' => 'api_users']) + ->setPass(['id']) + ->setPatterns(['id' => '[0-9]+']); + // These establish the usual CRUD options on all models: + $builder->delete( + '/{model}/{id}', ['controller' => 'ApiV2', 'action' => 'delete']) + ->setPass(['id']) + ->setPatterns(['id' => '[0-9]+']); + $builder->get( + '/{model}', + ['controller' => 'ApiV2', 'action' => 'index']); + $builder->get( + '/{model}/{id}', + ['controller' => 'ApiV2', 'action' => 'view']) + ->setPass(['id']) + ->setPatterns(['id' => '[0-9]+']); + $builder->post( + '/{model}', + ['controller' => 'ApiV2', 'action' => 'add']); + $builder->put( + '/{model}/{id}', + ['controller' => 'ApiV2', 'action' => 'edit']) + ->setPass(['id']) + ->setPatterns(['id' => '[0-9]+']); +}); + + +// Main application routes $routes->scope('/', function (RouteBuilder $builder) { // Register scoped middleware for in scopes. $builder->registerMiddleware('csrf', new CsrfProtectionMiddleware([ @@ -74,23 +122,6 @@ * ...and connect the rest of 'Pages' controller's URLs. */ $builder->connect('/pages/*', ['controller' => 'Pages', 'action' => 'display']); - - // Registry API routes - Router::scope('/api/v2', function ($routes) { - $routes->setExtensions(['json']); - $routes->applyMiddleware('bodyparser'); - // Use setPass to make parameter show up as function parameter - // Model specific actions, which will usually have more specific URLs: - $routes->post('/api_users/generate/{id}', - ['controller' => 'ApiV2', 'action' => 'generateApiKey', 'model' => 'api_users']) - ->setPass(['id']); - // These establish the usual CRUD options on all models: - $routes->delete('/{model}/{id}', ['controller' => 'ApiV2', 'action' => 'delete'])->setPass(['id']); - $routes->get('/{model}', ['controller' => 'ApiV2', 'action' => 'index']); - $routes->get('/{model}/{id}', ['controller' => 'ApiV2', 'action' => 'view'])->setPass(['id']); - $routes->post('/{model}', ['controller' => 'ApiV2', 'action' => 'add']); - $routes->put('/{model}/{id}', ['controller' => 'ApiV2', 'action' => 'edit'])->setPass(['id']); - }); /* * Connect catchall routes for all controllers. diff --git a/app/src/Command/DatabaseCommand.php b/app/src/Command/DatabaseCommand.php index 75749fdc..76c7f6b1 100644 --- a/app/src/Command/DatabaseCommand.php +++ b/app/src/Command/DatabaseCommand.php @@ -262,7 +262,7 @@ public function execute(Arguments $args, ConsoleIo $io) { // schema file). // $diffSql = $curSchema->getMigrateToSql($schema, $conn->getDatabasePlatform()); $comparator = new Comparator(); - $schemaDiff = $comparator->compare($curSchema, $schema); + $schemaDiff = $comparator->compareSchemas($curSchema, $schema); $diffSql = $schemaDiff->toSaveSql($conn->getDatabasePlatform()); diff --git a/app/src/Command/TransmogrifyCommand.php b/app/src/Command/TransmogrifyCommand.php index f20eeafe..ec662473 100644 --- a/app/src/Command/TransmogrifyCommand.php +++ b/app/src/Command/TransmogrifyCommand.php @@ -405,7 +405,7 @@ public function execute(Arguments $args, ConsoleIo $io) { $count = $this->inconn->fetchOne("SELECT COUNT(*) FROM " . $this->tables[$t]['source']); $insql = "SELECT * FROM " . $this->tables[$t]['source'] . " ORDER BY id ASC"; - $stmt = $this->inconn->query($insql); + $stmt = $this->inconn->executeQuery($insql); // Check if the table contains data $Model = $this->getTableLocator()->get($t); diff --git a/app/src/Controller/AppController.php b/app/src/Controller/AppController.php index 3161657b..d14fdeae 100644 --- a/app/src/Controller/AppController.php +++ b/app/src/Controller/AppController.php @@ -45,7 +45,8 @@ class AppController extends Controller { use \App\Lib\Traits\LabeledLogTrait; - + + // If set, the current requested CO. Note this may be *unauthenticated* // and so should not be trusted without further authorization. private $cur_co = null; @@ -522,7 +523,7 @@ protected function setCO() { } if($coid) { - $this->loadModel('Cos'); + $this->Cos = $this->fetchTable('Cos'); // This throws Cake\Datasource\Exception\RecordNotFoundException which // we just let pass up the stack. @@ -531,8 +532,9 @@ protected function setCO() { // While the COmanage CO cannot be suspended (AR-CO-2), this is enforced // at cos/edit, not here. - if($this->cur_co->status == TemplateableStatusEnum::Active) { + if($this->cur_co->status === TemplateableStatusEnum::Active) { $this->set('vv_cur_co', $this->cur_co); + } // We store the CO ID in Configuration to facilitate its access from diff --git a/app/src/Controller/StandardController.php b/app/src/Controller/StandardController.php index 180629d8..34331817 100644 --- a/app/src/Controller/StandardController.php +++ b/app/src/Controller/StandardController.php @@ -520,7 +520,7 @@ protected function populateAutoViewVars(object $obj=null) { case 'select': // We assume $modelName has a direct relationship to $avv['model'] $avvmodel = $avv['model']; - $this->loadModel($avvmodel); + $this->$avvmodel = $this->fetchTable($avvmodel); if($avv['type'] == 'auxiliary') { $query = $this->$avvmodel->find(); diff --git a/app/vendor/autoload.php b/app/vendor/autoload.php index 3e8e561e..b8de0f7f 100644 --- a/app/vendor/autoload.php +++ b/app/vendor/autoload.php @@ -2,6 +2,11 @@ // autoload.php @generated by Composer +if (PHP_VERSION_ID < 50600) { + echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; + exit(1); +} + require_once __DIR__ . '/composer/autoload_real.php'; return ComposerAutoloaderInitb25f76eec921984aa94dcf4015a4846e::getLoader(); diff --git a/app/vendor/bin/composer b/app/vendor/bin/composer deleted file mode 120000 index f4355157..00000000 --- a/app/vendor/bin/composer +++ /dev/null @@ -1 +0,0 @@ -../composer/composer/bin/composer \ No newline at end of file diff --git a/app/vendor/bin/composer b/app/vendor/bin/composer new file mode 100755 index 00000000..b48a11b3 --- /dev/null +++ b/app/vendor/bin/composer @@ -0,0 +1,117 @@ +#!/usr/bin/env php +realpath = realpath($opened_path) ?: $opened_path; + $opened_path = $this->realpath; + $this->handle = fopen($this->realpath, $mode); + $this->position = 0; + + return (bool) $this->handle; + } + + public function stream_read($count) + { + $data = fread($this->handle, $count); + + if ($this->position === 0) { + $data = preg_replace('{^#!.*\r?\n}', '', $data); + } + + $this->position += strlen($data); + + return $data; + } + + public function stream_cast($castAs) + { + return $this->handle; + } + + public function stream_close() + { + fclose($this->handle); + } + + public function stream_lock($operation) + { + return $operation ? flock($this->handle, $operation) : true; + } + + public function stream_seek($offset, $whence) + { + if (0 === fseek($this->handle, $offset, $whence)) { + $this->position = ftell($this->handle); + return true; + } + + return false; + } + + public function stream_tell() + { + return $this->position; + } + + public function stream_eof() + { + return feof($this->handle); + } + + public function stream_stat() + { + return array(); + } + + public function stream_set_option($option, $arg1, $arg2) + { + return true; + } + + public function url_stat($path, $flags) + { + $path = substr($path, 17); + if (file_exists($path)) { + return stat($path); + } + + return false; + } + } + } + + if (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) { + include("phpvfscomposer://" . __DIR__ . '/..'.'/composer/composer/bin/composer'); + exit(0); + } +} + +include __DIR__ . '/..'.'/composer/composer/bin/composer'; diff --git a/app/vendor/bin/doctrine-dbal b/app/vendor/bin/doctrine-dbal deleted file mode 120000 index 58a8a89c..00000000 --- a/app/vendor/bin/doctrine-dbal +++ /dev/null @@ -1 +0,0 @@ -../doctrine/dbal/bin/doctrine-dbal \ No newline at end of file diff --git a/app/vendor/bin/doctrine-dbal b/app/vendor/bin/doctrine-dbal new file mode 100755 index 00000000..374a92a0 --- /dev/null +++ b/app/vendor/bin/doctrine-dbal @@ -0,0 +1,117 @@ +#!/usr/bin/env php +realpath = realpath($opened_path) ?: $opened_path; + $opened_path = $this->realpath; + $this->handle = fopen($this->realpath, $mode); + $this->position = 0; + + return (bool) $this->handle; + } + + public function stream_read($count) + { + $data = fread($this->handle, $count); + + if ($this->position === 0) { + $data = preg_replace('{^#!.*\r?\n}', '', $data); + } + + $this->position += strlen($data); + + return $data; + } + + public function stream_cast($castAs) + { + return $this->handle; + } + + public function stream_close() + { + fclose($this->handle); + } + + public function stream_lock($operation) + { + return $operation ? flock($this->handle, $operation) : true; + } + + public function stream_seek($offset, $whence) + { + if (0 === fseek($this->handle, $offset, $whence)) { + $this->position = ftell($this->handle); + return true; + } + + return false; + } + + public function stream_tell() + { + return $this->position; + } + + public function stream_eof() + { + return feof($this->handle); + } + + public function stream_stat() + { + return array(); + } + + public function stream_set_option($option, $arg1, $arg2) + { + return true; + } + + public function url_stat($path, $flags) + { + $path = substr($path, 17); + if (file_exists($path)) { + return stat($path); + } + + return false; + } + } + } + + if (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) { + include("phpvfscomposer://" . __DIR__ . '/..'.'/doctrine/dbal/bin/doctrine-dbal'); + exit(0); + } +} + +include __DIR__ . '/..'.'/doctrine/dbal/bin/doctrine-dbal'; diff --git a/app/vendor/bin/jsonlint b/app/vendor/bin/jsonlint deleted file mode 120000 index 4282f173..00000000 --- a/app/vendor/bin/jsonlint +++ /dev/null @@ -1 +0,0 @@ -../seld/jsonlint/bin/jsonlint \ No newline at end of file diff --git a/app/vendor/bin/jsonlint b/app/vendor/bin/jsonlint new file mode 100755 index 00000000..513f1c97 --- /dev/null +++ b/app/vendor/bin/jsonlint @@ -0,0 +1,117 @@ +#!/usr/bin/env php +realpath = realpath($opened_path) ?: $opened_path; + $opened_path = $this->realpath; + $this->handle = fopen($this->realpath, $mode); + $this->position = 0; + + return (bool) $this->handle; + } + + public function stream_read($count) + { + $data = fread($this->handle, $count); + + if ($this->position === 0) { + $data = preg_replace('{^#!.*\r?\n}', '', $data); + } + + $this->position += strlen($data); + + return $data; + } + + public function stream_cast($castAs) + { + return $this->handle; + } + + public function stream_close() + { + fclose($this->handle); + } + + public function stream_lock($operation) + { + return $operation ? flock($this->handle, $operation) : true; + } + + public function stream_seek($offset, $whence) + { + if (0 === fseek($this->handle, $offset, $whence)) { + $this->position = ftell($this->handle); + return true; + } + + return false; + } + + public function stream_tell() + { + return $this->position; + } + + public function stream_eof() + { + return feof($this->handle); + } + + public function stream_stat() + { + return array(); + } + + public function stream_set_option($option, $arg1, $arg2) + { + return true; + } + + public function url_stat($path, $flags) + { + $path = substr($path, 17); + if (file_exists($path)) { + return stat($path); + } + + return false; + } + } + } + + if (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) { + include("phpvfscomposer://" . __DIR__ . '/..'.'/seld/jsonlint/bin/jsonlint'); + exit(0); + } +} + +include __DIR__ . '/..'.'/seld/jsonlint/bin/jsonlint'; diff --git a/app/vendor/bin/phinx b/app/vendor/bin/phinx deleted file mode 120000 index 8b2b0f45..00000000 --- a/app/vendor/bin/phinx +++ /dev/null @@ -1 +0,0 @@ -../robmorgan/phinx/bin/phinx \ No newline at end of file diff --git a/app/vendor/bin/phinx b/app/vendor/bin/phinx new file mode 100755 index 00000000..6734d67f --- /dev/null +++ b/app/vendor/bin/phinx @@ -0,0 +1,117 @@ +#!/usr/bin/env php +realpath = realpath($opened_path) ?: $opened_path; + $opened_path = $this->realpath; + $this->handle = fopen($this->realpath, $mode); + $this->position = 0; + + return (bool) $this->handle; + } + + public function stream_read($count) + { + $data = fread($this->handle, $count); + + if ($this->position === 0) { + $data = preg_replace('{^#!.*\r?\n}', '', $data); + } + + $this->position += strlen($data); + + return $data; + } + + public function stream_cast($castAs) + { + return $this->handle; + } + + public function stream_close() + { + fclose($this->handle); + } + + public function stream_lock($operation) + { + return $operation ? flock($this->handle, $operation) : true; + } + + public function stream_seek($offset, $whence) + { + if (0 === fseek($this->handle, $offset, $whence)) { + $this->position = ftell($this->handle); + return true; + } + + return false; + } + + public function stream_tell() + { + return $this->position; + } + + public function stream_eof() + { + return feof($this->handle); + } + + public function stream_stat() + { + return array(); + } + + public function stream_set_option($option, $arg1, $arg2) + { + return true; + } + + public function url_stat($path, $flags) + { + $path = substr($path, 17); + if (file_exists($path)) { + return stat($path); + } + + return false; + } + } + } + + if (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) { + include("phpvfscomposer://" . __DIR__ . '/..'.'/robmorgan/phinx/bin/phinx'); + exit(0); + } +} + +include __DIR__ . '/..'.'/robmorgan/phinx/bin/phinx'; diff --git a/app/vendor/bin/php-parse b/app/vendor/bin/php-parse deleted file mode 120000 index 062d66a3..00000000 --- a/app/vendor/bin/php-parse +++ /dev/null @@ -1 +0,0 @@ -../nikic/php-parser/bin/php-parse \ No newline at end of file diff --git a/app/vendor/bin/php-parse b/app/vendor/bin/php-parse new file mode 100755 index 00000000..80f0e486 --- /dev/null +++ b/app/vendor/bin/php-parse @@ -0,0 +1,117 @@ +#!/usr/bin/env php +realpath = realpath($opened_path) ?: $opened_path; + $opened_path = $this->realpath; + $this->handle = fopen($this->realpath, $mode); + $this->position = 0; + + return (bool) $this->handle; + } + + public function stream_read($count) + { + $data = fread($this->handle, $count); + + if ($this->position === 0) { + $data = preg_replace('{^#!.*\r?\n}', '', $data); + } + + $this->position += strlen($data); + + return $data; + } + + public function stream_cast($castAs) + { + return $this->handle; + } + + public function stream_close() + { + fclose($this->handle); + } + + public function stream_lock($operation) + { + return $operation ? flock($this->handle, $operation) : true; + } + + public function stream_seek($offset, $whence) + { + if (0 === fseek($this->handle, $offset, $whence)) { + $this->position = ftell($this->handle); + return true; + } + + return false; + } + + public function stream_tell() + { + return $this->position; + } + + public function stream_eof() + { + return feof($this->handle); + } + + public function stream_stat() + { + return array(); + } + + public function stream_set_option($option, $arg1, $arg2) + { + return true; + } + + public function url_stat($path, $flags) + { + $path = substr($path, 17); + if (file_exists($path)) { + return stat($path); + } + + return false; + } + } + } + + if (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) { + include("phpvfscomposer://" . __DIR__ . '/..'.'/nikic/php-parser/bin/php-parse'); + exit(0); + } +} + +include __DIR__ . '/..'.'/nikic/php-parser/bin/php-parse'; diff --git a/app/vendor/bin/phpcbf b/app/vendor/bin/phpcbf deleted file mode 120000 index bdf04fbc..00000000 --- a/app/vendor/bin/phpcbf +++ /dev/null @@ -1 +0,0 @@ -../squizlabs/php_codesniffer/bin/phpcbf \ No newline at end of file diff --git a/app/vendor/bin/phpcbf b/app/vendor/bin/phpcbf new file mode 100755 index 00000000..dd5f763d --- /dev/null +++ b/app/vendor/bin/phpcbf @@ -0,0 +1,117 @@ +#!/usr/bin/env php +realpath = realpath($opened_path) ?: $opened_path; + $opened_path = $this->realpath; + $this->handle = fopen($this->realpath, $mode); + $this->position = 0; + + return (bool) $this->handle; + } + + public function stream_read($count) + { + $data = fread($this->handle, $count); + + if ($this->position === 0) { + $data = preg_replace('{^#!.*\r?\n}', '', $data); + } + + $this->position += strlen($data); + + return $data; + } + + public function stream_cast($castAs) + { + return $this->handle; + } + + public function stream_close() + { + fclose($this->handle); + } + + public function stream_lock($operation) + { + return $operation ? flock($this->handle, $operation) : true; + } + + public function stream_seek($offset, $whence) + { + if (0 === fseek($this->handle, $offset, $whence)) { + $this->position = ftell($this->handle); + return true; + } + + return false; + } + + public function stream_tell() + { + return $this->position; + } + + public function stream_eof() + { + return feof($this->handle); + } + + public function stream_stat() + { + return array(); + } + + public function stream_set_option($option, $arg1, $arg2) + { + return true; + } + + public function url_stat($path, $flags) + { + $path = substr($path, 17); + if (file_exists($path)) { + return stat($path); + } + + return false; + } + } + } + + if (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) { + include("phpvfscomposer://" . __DIR__ . '/..'.'/squizlabs/php_codesniffer/bin/phpcbf'); + exit(0); + } +} + +include __DIR__ . '/..'.'/squizlabs/php_codesniffer/bin/phpcbf'; diff --git a/app/vendor/bin/phpcs b/app/vendor/bin/phpcs deleted file mode 120000 index 9481d68a..00000000 --- a/app/vendor/bin/phpcs +++ /dev/null @@ -1 +0,0 @@ -../squizlabs/php_codesniffer/bin/phpcs \ No newline at end of file diff --git a/app/vendor/bin/phpcs b/app/vendor/bin/phpcs new file mode 100755 index 00000000..5123b7d6 --- /dev/null +++ b/app/vendor/bin/phpcs @@ -0,0 +1,117 @@ +#!/usr/bin/env php +realpath = realpath($opened_path) ?: $opened_path; + $opened_path = $this->realpath; + $this->handle = fopen($this->realpath, $mode); + $this->position = 0; + + return (bool) $this->handle; + } + + public function stream_read($count) + { + $data = fread($this->handle, $count); + + if ($this->position === 0) { + $data = preg_replace('{^#!.*\r?\n}', '', $data); + } + + $this->position += strlen($data); + + return $data; + } + + public function stream_cast($castAs) + { + return $this->handle; + } + + public function stream_close() + { + fclose($this->handle); + } + + public function stream_lock($operation) + { + return $operation ? flock($this->handle, $operation) : true; + } + + public function stream_seek($offset, $whence) + { + if (0 === fseek($this->handle, $offset, $whence)) { + $this->position = ftell($this->handle); + return true; + } + + return false; + } + + public function stream_tell() + { + return $this->position; + } + + public function stream_eof() + { + return feof($this->handle); + } + + public function stream_stat() + { + return array(); + } + + public function stream_set_option($option, $arg1, $arg2) + { + return true; + } + + public function url_stat($path, $flags) + { + $path = substr($path, 17); + if (file_exists($path)) { + return stat($path); + } + + return false; + } + } + } + + if (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) { + include("phpvfscomposer://" . __DIR__ . '/..'.'/squizlabs/php_codesniffer/bin/phpcs'); + exit(0); + } +} + +include __DIR__ . '/..'.'/squizlabs/php_codesniffer/bin/phpcs'; diff --git a/app/vendor/bin/phpunit b/app/vendor/bin/phpunit deleted file mode 120000 index 2c489303..00000000 --- a/app/vendor/bin/phpunit +++ /dev/null @@ -1 +0,0 @@ -../phpunit/phpunit/phpunit \ No newline at end of file diff --git a/app/vendor/bin/phpunit b/app/vendor/bin/phpunit new file mode 100755 index 00000000..c52ed8c3 --- /dev/null +++ b/app/vendor/bin/phpunit @@ -0,0 +1,120 @@ +#!/usr/bin/env php +realpath = realpath($opened_path) ?: $opened_path; + $opened_path = 'phpvfscomposer://'.$this->realpath; + $this->handle = fopen($this->realpath, $mode); + $this->position = 0; + + return (bool) $this->handle; + } + + public function stream_read($count) + { + $data = fread($this->handle, $count); + + if ($this->position === 0) { + $data = preg_replace('{^#!.*\r?\n}', '', $data); + } + $data = str_replace('__DIR__', var_export(dirname($this->realpath), true), $data); + $data = str_replace('__FILE__', var_export($this->realpath, true), $data); + + $this->position += strlen($data); + + return $data; + } + + public function stream_cast($castAs) + { + return $this->handle; + } + + public function stream_close() + { + fclose($this->handle); + } + + public function stream_lock($operation) + { + return $operation ? flock($this->handle, $operation) : true; + } + + public function stream_seek($offset, $whence) + { + if (0 === fseek($this->handle, $offset, $whence)) { + $this->position = ftell($this->handle); + return true; + } + + return false; + } + + public function stream_tell() + { + return $this->position; + } + + public function stream_eof() + { + return feof($this->handle); + } + + public function stream_stat() + { + return array(); + } + + public function stream_set_option($option, $arg1, $arg2) + { + return true; + } + + public function url_stat($path, $flags) + { + $path = substr($path, 17); + if (file_exists($path)) { + return stat($path); + } + + return false; + } + } + } + + if (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) { + include("phpvfscomposer://" . __DIR__ . '/..'.'/phpunit/phpunit/phpunit'); + exit(0); + } +} + +include __DIR__ . '/..'.'/phpunit/phpunit/phpunit'; diff --git a/app/vendor/bin/psysh b/app/vendor/bin/psysh deleted file mode 120000 index 3c06b1ae..00000000 --- a/app/vendor/bin/psysh +++ /dev/null @@ -1 +0,0 @@ -../psy/psysh/bin/psysh \ No newline at end of file diff --git a/app/vendor/bin/psysh b/app/vendor/bin/psysh new file mode 100755 index 00000000..c10304ba --- /dev/null +++ b/app/vendor/bin/psysh @@ -0,0 +1,117 @@ +#!/usr/bin/env php +realpath = realpath($opened_path) ?: $opened_path; + $opened_path = $this->realpath; + $this->handle = fopen($this->realpath, $mode); + $this->position = 0; + + return (bool) $this->handle; + } + + public function stream_read($count) + { + $data = fread($this->handle, $count); + + if ($this->position === 0) { + $data = preg_replace('{^#!.*\r?\n}', '', $data); + } + + $this->position += strlen($data); + + return $data; + } + + public function stream_cast($castAs) + { + return $this->handle; + } + + public function stream_close() + { + fclose($this->handle); + } + + public function stream_lock($operation) + { + return $operation ? flock($this->handle, $operation) : true; + } + + public function stream_seek($offset, $whence) + { + if (0 === fseek($this->handle, $offset, $whence)) { + $this->position = ftell($this->handle); + return true; + } + + return false; + } + + public function stream_tell() + { + return $this->position; + } + + public function stream_eof() + { + return feof($this->handle); + } + + public function stream_stat() + { + return array(); + } + + public function stream_set_option($option, $arg1, $arg2) + { + return true; + } + + public function url_stat($path, $flags) + { + $path = substr($path, 17); + if (file_exists($path)) { + return stat($path); + } + + return false; + } + } + } + + if (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) { + include("phpvfscomposer://" . __DIR__ . '/..'.'/psy/psysh/bin/psysh'); + exit(0); + } +} + +include __DIR__ . '/..'.'/psy/psysh/bin/psysh'; diff --git a/app/vendor/bin/validate-json b/app/vendor/bin/validate-json deleted file mode 120000 index 141e2510..00000000 --- a/app/vendor/bin/validate-json +++ /dev/null @@ -1 +0,0 @@ -../justinrainbow/json-schema/bin/validate-json \ No newline at end of file diff --git a/app/vendor/bin/validate-json b/app/vendor/bin/validate-json new file mode 100755 index 00000000..5910c815 --- /dev/null +++ b/app/vendor/bin/validate-json @@ -0,0 +1,117 @@ +#!/usr/bin/env php +realpath = realpath($opened_path) ?: $opened_path; + $opened_path = $this->realpath; + $this->handle = fopen($this->realpath, $mode); + $this->position = 0; + + return (bool) $this->handle; + } + + public function stream_read($count) + { + $data = fread($this->handle, $count); + + if ($this->position === 0) { + $data = preg_replace('{^#!.*\r?\n}', '', $data); + } + + $this->position += strlen($data); + + return $data; + } + + public function stream_cast($castAs) + { + return $this->handle; + } + + public function stream_close() + { + fclose($this->handle); + } + + public function stream_lock($operation) + { + return $operation ? flock($this->handle, $operation) : true; + } + + public function stream_seek($offset, $whence) + { + if (0 === fseek($this->handle, $offset, $whence)) { + $this->position = ftell($this->handle); + return true; + } + + return false; + } + + public function stream_tell() + { + return $this->position; + } + + public function stream_eof() + { + return feof($this->handle); + } + + public function stream_stat() + { + return array(); + } + + public function stream_set_option($option, $arg1, $arg2) + { + return true; + } + + public function url_stat($path, $flags) + { + $path = substr($path, 17); + if (file_exists($path)) { + return stat($path); + } + + return false; + } + } + } + + if (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) { + include("phpvfscomposer://" . __DIR__ . '/..'.'/justinrainbow/json-schema/bin/validate-json'); + exit(0); + } +} + +include __DIR__ . '/..'.'/justinrainbow/json-schema/bin/validate-json'; diff --git a/app/vendor/bin/var-dump-server b/app/vendor/bin/var-dump-server deleted file mode 120000 index 6bd4e93d..00000000 --- a/app/vendor/bin/var-dump-server +++ /dev/null @@ -1 +0,0 @@ -../symfony/var-dumper/Resources/bin/var-dump-server \ No newline at end of file diff --git a/app/vendor/bin/var-dump-server b/app/vendor/bin/var-dump-server new file mode 100755 index 00000000..527f3ed4 --- /dev/null +++ b/app/vendor/bin/var-dump-server @@ -0,0 +1,117 @@ +#!/usr/bin/env php +realpath = realpath($opened_path) ?: $opened_path; + $opened_path = $this->realpath; + $this->handle = fopen($this->realpath, $mode); + $this->position = 0; + + return (bool) $this->handle; + } + + public function stream_read($count) + { + $data = fread($this->handle, $count); + + if ($this->position === 0) { + $data = preg_replace('{^#!.*\r?\n}', '', $data); + } + + $this->position += strlen($data); + + return $data; + } + + public function stream_cast($castAs) + { + return $this->handle; + } + + public function stream_close() + { + fclose($this->handle); + } + + public function stream_lock($operation) + { + return $operation ? flock($this->handle, $operation) : true; + } + + public function stream_seek($offset, $whence) + { + if (0 === fseek($this->handle, $offset, $whence)) { + $this->position = ftell($this->handle); + return true; + } + + return false; + } + + public function stream_tell() + { + return $this->position; + } + + public function stream_eof() + { + return feof($this->handle); + } + + public function stream_stat() + { + return array(); + } + + public function stream_set_option($option, $arg1, $arg2) + { + return true; + } + + public function url_stat($path, $flags) + { + $path = substr($path, 17); + if (file_exists($path)) { + return stat($path); + } + + return false; + } + } + } + + if (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) { + include("phpvfscomposer://" . __DIR__ . '/..'.'/symfony/var-dumper/Resources/bin/var-dump-server'); + exit(0); + } +} + +include __DIR__ . '/..'.'/symfony/var-dumper/Resources/bin/var-dump-server'; diff --git a/app/vendor/cakephp/bake/composer.json b/app/vendor/cakephp/bake/composer.json index cd74c330..96daca72 100644 --- a/app/vendor/cakephp/bake/composer.json +++ b/app/vendor/cakephp/bake/composer.json @@ -19,13 +19,13 @@ }, "require": { "php": ">=7.2", - "cakephp/cakephp": "^4.1", + "cakephp/cakephp": "^4.3.0", "cakephp/twig-view": "^1.0.2", "brick/varexporter": "^0.3.5" }, "require-dev": { "cakephp/cakephp-codesniffer": "^4.0", - "phpunit/phpunit": "~8.5.0", + "phpunit/phpunit": "^8.5 || ^9.3", "cakephp/debug_kit": "^4.1", "cakephp/plugin-installer": "^1.3" }, @@ -41,8 +41,7 @@ "Pastry\\PastryTest\\": "tests/test_app/Plugin/PastryTest/src/", "WithBakeSubFolder\\": "tests/test_app/Plugin/WithBakeSubFolder/src/", "Bake\\Test\\": "tests/", - "Bake\\Test\\App\\": "tests/test_app/App/", - "Cake\\Test\\": "vendor/cakephp/cakephp/tests/" + "Bake\\Test\\App\\": "tests/test_app/App/" } }, "scripts": { @@ -53,8 +52,14 @@ "cs-check": "phpcs --parallel=16 -p src/ tests/", "cs-fix": "phpcbf --parallel=16 -p src/ tests/", "stan": "phpstan analyse src/ && psalm.phar", - "stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:0.12.82 psalm/phar:~4.7.0 && mv composer.backup composer.json", + "stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:^1.5 psalm/phar:~4.22.0 && mv composer.backup composer.json", "test": "phpunit", "test-coverage": "phpunit --coverage-clover=clover.xml" + }, + "config": { + "allow-plugins": { + "cakephp/plugin-installer": true, + "dealerdirect/phpcodesniffer-composer-installer": true + } } } diff --git a/app/vendor/cakephp/bake/docs.Dockerfile b/app/vendor/cakephp/bake/docs.Dockerfile index adb6e944..1f7afabd 100644 --- a/app/vendor/cakephp/bake/docs.Dockerfile +++ b/app/vendor/cakephp/bake/docs.Dockerfile @@ -2,14 +2,20 @@ FROM markstory/cakephp-docs-builder as builder # Copy entire repo in with .git so we can build all versions in one image. -COPY docs /data/src +COPY docs /data/docs RUN cd /data/docs-builder \ - && make website LANGS="en es fr ja pt ru" SOURCE=/data/src DEST=/data/website/ + && make website LANGS="en es fr ja pt ru" SOURCE=/data/docs DEST=/data/website/ # Build a small nginx container with just the static site in it. -FROM nginx:1.15-alpine +FROM markstory/cakephp-docs-builder:runtime as runtime +# Configure search index script +ENV LANGS="en es fr ja pt ru" +ENV SEARCH_SOURCE="/usr/share/nginx/html" +ENV SEARCH_URL_PREFIX="/bake/2" + +COPY --from=builder /data/docs /data/docs COPY --from=builder /data/website /data/website COPY --from=builder /data/docs-builder/nginx.conf /etc/nginx/conf.d/default.conf diff --git a/app/vendor/cakephp/bake/docs/config/all.py b/app/vendor/cakephp/bake/docs/config/all.py index 9e899be5..26052263 100644 --- a/app/vendor/cakephp/bake/docs/config/all.py +++ b/app/vendor/cakephp/bake/docs/config/all.py @@ -32,7 +32,7 @@ # The GitHub branch name for this version of the docs # for edit links to point at. -branch = 'master' +branch = '2.x' # Current version being built version = '2.x' diff --git a/app/vendor/cakephp/bake/docs/en/development.rst b/app/vendor/cakephp/bake/docs/en/development.rst index e1c1aa7b..735c4183 100644 --- a/app/vendor/cakephp/bake/docs/en/development.rst +++ b/app/vendor/cakephp/bake/docs/en/development.rst @@ -102,11 +102,6 @@ Bake Template Syntax Bake template files use the `Twig `__ template syntax. -One way to see/understand how bake templates works, especially when attempting -to modify bake template files, is to bake a class and compare the template used -with the pre-processed template file which is left in the application's -**tmp/bake** folder. - So, for example, when baking a command like so: .. code-block:: bash diff --git a/app/vendor/cakephp/bake/docs/fr/development.rst b/app/vendor/cakephp/bake/docs/fr/development.rst index 61de705d..b4f72c38 100644 --- a/app/vendor/cakephp/bake/docs/fr/development.rst +++ b/app/vendor/cakephp/bake/docs/fr/development.rst @@ -3,7 +3,8 @@ Etendre Bake Bake dispose d'une architecture extensible qui permet à votre application ou à vos plugins de modifier ou ajouter la fonctionnalité de base. Bake utilise une -classe de vue dédiée qui n'utilise pas la syntaxe PHP standard. +classe de vue dédiée qui utilise le moteur de template +`Twig `_. Events de Bake ============== @@ -18,12 +19,12 @@ s'appliquent à toutes les sorties fabriquées avec bake, par exemple pour ajout un autre helper à la classe de vue bake, cet event peut être utilisé:: on('Bake.initialize', function (Event $event) { + // dans src/Application::bootstrapCli() + + EventManager::instance()->on('Bake.initialize', function (EventInterface $event) { $view = $event->getSubject(); // Dans mes templates de bake, permet l'utilisation du helper MySpecial @@ -34,10 +35,6 @@ un autre helper à la classe de vue bake, cet event peut être utilisé:: }); -Si vous souhaitez modifier bake à partir d'un autre plugin, mettre les events -de bake de votre plugin dans le fichier ``config/bootstrap.php`` du plugin est -une bonne idée. - Les events de bake peuvent être pratiques pour faire de petits changements dans les templates existants. Par exemple, pour changer les noms de variables utilisés lors de la création avec bake de fichiers de controller/template, on @@ -45,15 +42,15 @@ pourra utiliser une fonction qui écoute ``Bake.beforeRender`` pour modifier les variables utilisées dans les templates de bake:: on('Bake.beforeRender', function (Event $event) { + // dans src/Application::bootstrapCli() + + EventManager::instance()->on('Bake.beforeRender', function (EventInterface $event) { $view = $event->getSubject(); - // Utilise $rows pour les principales variables de données dans les indexes + // Utilise $rows pour la principale variable de données dans les index if ($view->get('pluralName')) { $view->set('pluralName', 'rows'); } @@ -61,7 +58,7 @@ variables utilisées dans les templates de bake:: $view->set('pluralVar', 'rows'); } - // Utilise $theOne pour les principales variable de données dans les view/edit + // Utilise $theOne pour la principale variable de données dans les view/edit if ($view->get('singularName')) { $view->set('singularName', 'theOne'); } @@ -74,23 +71,23 @@ variables utilisées dans les templates de bake:: Vous pouvez aussi scoper les events ``Bake.beforeRender`` et ``Bake.afterRender`` dans un fichier généré spécifique. Par exemple, si vous souhaitez ajouter des actions spécifiques à votre UsersController quand vous le -générez à partir d'un fichier **Controller/controller.ctp**, vous pouvez +générez à partir d'un fichier **Controller/controller.twig**, vous pouvez utiliser l'event suivant:: on( 'Bake.beforeRender.Controller.controller', - function (Event $event) { - $view = $event->subject; - if ($view->viewVars['name'] == 'Users') { + function (EventInterface $event) { + $view = $event->getSubject(); + if ($view->get('name') === 'Users') { // ajouter les actions login et logout au controller Users - $view->viewVars['actions'] = [ + $view->set('actions', [ 'login', 'logout', 'index', @@ -110,237 +107,236 @@ qui sont plus faciles à tester. Syntaxe de Template de Bake =========================== -Les fichiers de template de Bake utilisent les balises erb-style (``<% %>``) -pour indiquer la logique des templates, et traitent le reste, y compris les -balises php, comme du texte. - -.. note:: - - Les fichiers de template de Bake n'utilisent pas, et sont insensibles aux - ``asp_tags`` de la configuration de php ini. - -``BakeView`` intègre les balises suivantes: - - * ``<%`` Une balise php ouverte de template de Bake - * ``%>`` Une balise php fermante de template de Bake - * ``<%=`` Une balise php de short-echo de template de Bake - * ``<%-`` Une balise php ouverte de template de Bake, enlevant tout espace - en tête avant la balise - * ``-%>`` Une balise php fermante de template de Bake, enlevant les espaces - à a fin après la balise - -Une façon de voir/comprendre la façon dont les templates de Bake fonctionne, -spécialement quand on essaie de modifier les fichiers de template de bake, est -de créer avec bake une classe et de comparer le template utilisé avec le -template déjà présent dans le dossier **tmp/bake** de votre application. +Les fichiers de template de Bake utilisent la syntaxe de template de +`Twig `__. Ainsi, par exemple, pour créer avec bake un shell comme ceci: .. code-block:: bash - bin/cake bake shell Foo + bin/cake bake command Foo Le template utilisé -(**vendor/cakephp/cakephp/src/Template/Bake/Shell/shell.ctp**) +(***vendor/cakephp/bake/templates/bake/Command/command.twig**) ressemble à ceci:: - \Shell; + declare(strict_types=1); + + namespace {{ namespace }}\Command; - use Cake\Console\Shell; + use Cake\Command\Command; + use Cake\Console\Arguments; + use Cake\Console\ConsoleIo; + use Cake\Console\ConsoleOptionParser; /** - * <%= $name %> shell command. - */ - class <%= $name %>Shell extends Shell + * {{ name }} command. + */ + class {{ name }}Command extends Command { - /** - * main() method. - * - * @return bool|int Success or error code. - */ - public function main() + * Méthode hook pour définir le parseur d'option de cette commande. + * + * @see https://book.cakephp.org/4/fr/console-commands/commands.html#defining-arguments-and-options + * @param \Cake\Console\ConsoleOptionParser $parser Le parseur à définir + * @return \Cake\Console\ConsoleOptionParser Le parseur construit. + */ + public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionParser { - } - - } - -Le fichier template déjà présent (pre-processed) -(**tmp/bake/Bake-Shell-shell-ctp.php**), qui est le fichier réellement -rendu, ressemble à ceci:: - - \Shell; + $parser = parent::buildOptionParser($parser); - use Cake\Console\Shell; - - /** - * shell command. - */ - class Shell extends Shell - { + return $parser; + } /** - * main() method. - * - * @return bool|int Success or error code. - */ - public function main() + * Implémentez cette méthode avec la logique de votre commande. + * + * @param \Cake\Console\Arguments $args Les arguments de la commande. + * @param \Cake\Console\ConsoleIo $io La console il + * @return null|void|int Le code de sortie ou null pour un succès + */ + public function execute(Arguments $args, ConsoleIo $io) { } - } -Et la classe résultante construite avec bake (**src/Shell/FooShell.php**) +Et la classe résultante construite avec bake (**src/Command/FooCommand.php**) ressemble à ceci:: \Foo; + namespace {{ namespace }}\FooPath; /** - * <%= $name %> foo + * {{ name }} fooOut */ - class <%= $name %>Foo + class {{ name }}FooOut { - // Add code. + // Ajouter le code. } -Vous devriez maintenant voir votre nouvelle tâche dans l'affichage de +Vous devriez maintenant voir votre nouvelle commande dans l'affichage de ``bin/cake bake``. Vous pouvez lancer votre nouvelle tâche en exécutant -``bin/cake bake foo Example``. -Cela va générer une nouvelle classe ``ExampleFoo`` dans -**src/Foo/ExampleFoo.php** que votre application va +``bin/cake bake foo Exemple``. +Cela va générer une nouvelle classe ``ExempleFoo`` dans +**src/FooPath/ExempleFooOut.php** que votre application va pouvoir utiliser. Si vous souhaitez que votre appel à ``bake`` crée également un fichier de test -pour la classe ``ExampleFoo``, vous devrez surcharger la méthode ``bakeTest()`` -dans la classe ``FooTask`` pour y définir le suffixe et le namespace de la +pour la classe ``ExempleFooOut``, vous devrez surcharger la méthode ``bakeTest()`` +dans la classe ``FooCommand`` pour y définir le suffixe et le namespace de la classe de votre nom de commande personnalisée:: - public function bakeTest($className) + use Cake\Console\Arguments; + use Cake\Console\ConsoleIo; + + public function bakeTest(string $className, Arguments $args, ConsoleIo $io): void { if (!isset($this->Test->classSuffixes[$this->name()])) { - $this->Test->classSuffixes[$this->name()] = 'Foo'; + $this->Test->classSuffixes[$this->name()] = 'Foo'; } $name = ucfirst($this->name()); if (!isset($this->Test->classTypes[$name])) { - $this->Test->classTypes[$name] = 'Foo'; + $this->Test->classTypes[$name] = 'Foo'; } return parent::bakeTest($className); } * Le **suffixe de classe** sera ajouté après le nom passé à ``bake``. Dans le - cadre de l'exemple ci-dessus, cela créerait un fichier ``ExampleFooTest.php``. + cadre de l'exemple ci-dessus, cela créerait un fichier ``ExempleFooTest.php``. * Le **type de classe** sera le sous-namespace utilisé pour atteindre votre fichier (relatif à l'application ou au plugin dans lequel vous faites le ``bake``). Dans le cadre de l'exemple ci-dessus, cela créerait le test avec le diff --git a/app/vendor/cakephp/bake/docs/fr/index.rst b/app/vendor/cakephp/bake/docs/fr/index.rst index c086cac4..80e39229 100644 --- a/app/vendor/cakephp/bake/docs/fr/index.rst +++ b/app/vendor/cakephp/bake/docs/fr/index.rst @@ -16,11 +16,15 @@ Avant d'essayer d'utiliser ou d'étendre bake, assurez-vous qu'il est installé dans votre application. Bake est disponible en tant que plugin que vous pouvez installer avec Composer:: - composer require --dev cakephp/bake:~1.0 + composer require --dev cakephp/bake:"^2.0" Ceci va installer bake en tant que dépendance de développement. Cela signifie qu'il ne sera pas installé lors d'un déploiement en production. +Quand vous utilisez les templates Twig, vérifiez que vous chargez le plugin +``Cake/TwigView`` avec son bootstrap. Vous pouvez aussi l'omettre complètement, +ce qui fait que Bake chargera ce plugin à la demande. + .. meta:: :title lang=fr: Console Bake :keywords lang=fr: interface ligne de commande,development,bake view, bake template syntaxe,erb tags,asp tags,percent tags diff --git a/app/vendor/cakephp/bake/docs/fr/usage.rst b/app/vendor/cakephp/bake/docs/fr/usage.rst index 56e891a1..79f9f495 100644 --- a/app/vendor/cakephp/bake/docs/fr/usage.rst +++ b/app/vendor/cakephp/bake/docs/fr/usage.rst @@ -1,101 +1,58 @@ Génération de Code avec Bake ############################ -Suivant la configuration de votre installation, vous devrez peut être donner -les droits d'exécution au script bash cake ou l'appeler avec la commande -``./bin/cake bake``. -La console cake est exécutée en utilisant le CLI PHP +La console Bake est exécutée en utilisant le CLI PHP (Interface de Ligne de Commande). Si vous avez des problèmes en exécutant ce script, vérifiez que : #. le CLI PHP est installé et qu'il a les bons modules activés (ex: MySQL, intl). -#. Certains utilisateurs peuvent aussi rencontrer des problèmes si la base de - données host est 'localhost' et devront essayer '127.0.0.1' à la place. -#. Selon la configuration de votre ordinateur, vous devrez peut-être permettre - l'exécution du script bash pour permettre de lancer ``bin/cake bake``. - -Avant de lancer bake, vous devrez vous assurer qu'au moins une connection à une -base de données est configurée. - -Si vous exécutez la commande sans argument, ``bin/cake bake`` affichera la liste -des tâches disponibles. Vous devriez voir quelque chose comme ceci:: - - $ bin/cake bake - - Welcome to CakePHP v3.x.x Console - --------------------------------------------------------------- - App : src - Path: /var/www/cakephp.dev/src/ - --------------------------------------------------------------- - Les commandes suivantes avec lesquelles vous pouvez générer un squelette de - code pour votre application. - - Les commandes disponibles de bake: - - - all - - behavior - - cell - - component - - controller - - fixture - - form - - helper - - mailer - - migration - - migration_snapshot - - model - - plugin - - shell - - shell-helper - - template - - test - - En utilisant `cake bake [name]` vous pouvez faire appel à une tâche - spécifique de bake. - -Vous pouvez obtenir plus d'informations sur ce que chaque tâche fait et les -options disponibles en utilisant l'option ``--help``:: - - $ bin/cake bake controller --help - - Welcome to CakePHP v3.x.x Console - --------------------------------------------------------------- - App : src - Path: /var/www/cakephp.dev/src/ - --------------------------------------------------------------- - Bake a controller skeleton. - - Usage: - cake bake controller [subcommand] [options] [] - - Subcommands: - - all Bake all controllers with CRUD methods. - - To see help on a subcommand use `cake bake controller [subcommand] --help` - - Options: - - --help, -h Display this help. - --verbose, -v Enable verbose output. - --quiet, -q Enable quiet output. - --plugin, -p Plugin to bake into. - --force, -f Force overwriting existing files without prompting. - --connection, -c The datasource connection to get data from. - (default: default) - --theme, -t The theme to use when baking code. - --components The comma separated list of components to use. - --helpers The comma separated list of helpers to use. - --prefix The namespace/routing prefix to use. - --no-test Do not generate a test skeleton. - --no-actions Do not generate basic CRUD action methods. - - Arguments: - - name Name of the controller to bake. Can use Plugin.name to bake - controllers into plugins. (optional) - -Themes de Bake +#. Certains utilisateurs peuvent aussi rencontrer des problèmes si l'hôte de la + base de données est 'localhost' et devront essayer '127.0.0.1' à la place, + car localhost peut causer des problèmes avec PHP CLI. +#. Selon la configuration de votre ordinateur, vous devrez peut-être donner les + permissions d'exécution sur le script bash cake pour autoriser le lancement + par ``bin/cake bake``. + +Avant de lancer bake, vous devrez vous assurer que vous avez au moins une +connexion de base de données configurée. + +Vous pouvez voir la liste des commandes bake disponibles en lançant +``bin/cake bake --help`` (pour Windows ``bin\cake bake --help``) :: + + $ bin/cake bake --help + Current Paths: + + * app: src/ + * root: /path/to/your/app/ + * core: /path/to/your/app/vendor/cakephp/cakephp/ + + Available Commands: + + Bake: + - bake all + - bake behavior + - bake cell + - bake command + - bake component + - bake controller + - bake controller all + - bake fixture + - bake fixture all + - bake form + - bake helper + - bake mailer + - bake middleware + - bake model + - bake model all + - bake plugin + - bake template + - bake template all + - bake test + + To run a command, type `cake command_name [args|options]` + To get help on a specific command, type `cake command_name --help` + +Thèmes de Bake ============== L'option theme est commune à toutes les commandes de bake, et permet de changer diff --git a/app/vendor/cakephp/bake/docs/ja/development.rst b/app/vendor/cakephp/bake/docs/ja/development.rst index a7d733ed..070e43a5 100644 --- a/app/vendor/cakephp/bake/docs/ja/development.rst +++ b/app/vendor/cakephp/bake/docs/ja/development.rst @@ -109,11 +109,6 @@ Bake テンプレート構文 Bake テンプレートファイルは、 `Twig `__ テンプレート構文を使用します。 -bake テンプレートがどのように動作するかを確認/理解する一つの方法は、 -bake テンプレートファイルを変更しようとする場合は特に、クラスを bake して、 -アプリケーションの **tmp/bake** フォルダー内に残っている前処理されたテンプレートファイルを -使ったテンプレートと比較することです。 - だから、例えば、以下のようにシェルを bake した場合: .. code-block:: bash diff --git a/app/vendor/cakephp/bake/docs/pt/development.rst b/app/vendor/cakephp/bake/docs/pt/development.rst index 5e4fb05f..9a24232b 100644 --- a/app/vendor/cakephp/bake/docs/pt/development.rst +++ b/app/vendor/cakephp/bake/docs/pt/development.rst @@ -109,11 +109,6 @@ Sintaxe de Templates do Bake Os arquivos de templates do Bake usam a sintaxe `Twig `__. -Uma forma de ver e entender como o bake funciona, especialmente quando tentamos -modificar os arquivos de templates, é executar o bake de uma classe que compara -o template usado com o template pré-processado deixado anteriormente pela -aplicação na pasta **tmp/bake**. - Então, por exemplo, quando você executar algo como:: .. code-block:: bash diff --git a/app/vendor/cakephp/bake/docs/ru/development.rst b/app/vendor/cakephp/bake/docs/ru/development.rst index 5b7de8ec..568068db 100644 --- a/app/vendor/cakephp/bake/docs/ru/development.rst +++ b/app/vendor/cakephp/bake/docs/ru/development.rst @@ -106,11 +106,6 @@ Bake имеет расширяемую архитектуру, которая п Файлы шаблонов Bake используют синтаксис шаблонизатора `Twig `__. -Один из способов увидеть/понять, как работают шаблоны выпечки, особенно при попытке -изменить файлы шаблонов выпечки, это - испечь класс и сравнить используемый шаблон -с предварительно обработанным файлом шаблона, который остаётся в приложении в папке -**tmp/bake**. - Так, например, при выпечке такой оболочки: .. code-block:: bash diff --git a/app/vendor/cakephp/bake/phpstan.neon b/app/vendor/cakephp/bake/phpstan.neon index 4decabc0..ac6727fb 100644 --- a/app/vendor/cakephp/bake/phpstan.neon +++ b/app/vendor/cakephp/bake/phpstan.neon @@ -2,6 +2,6 @@ parameters: level: 6 checkMissingIterableValueType: false paths: - - src + - src/ bootstrapFiles: - tests/bootstrap.php diff --git a/app/vendor/cakephp/bake/psalm.xml b/app/vendor/cakephp/bake/psalm.xml index de014916..8f0d13b5 100644 --- a/app/vendor/cakephp/bake/psalm.xml +++ b/app/vendor/cakephp/bake/psalm.xml @@ -1,6 +1,5 @@ out('Bake All complete.', 1, ConsoleIo::QUIET); + $io->out('Bake All complete.', 1, ConsoleIo::NORMAL); return static::CODE_SUCCESS; } diff --git a/app/vendor/cakephp/bake/src/Command/BakeCommand.php b/app/vendor/cakephp/bake/src/Command/BakeCommand.php index 24f23da6..6ca98b70 100644 --- a/app/vendor/cakephp/bake/src/Command/BakeCommand.php +++ b/app/vendor/cakephp/bake/src/Command/BakeCommand.php @@ -161,7 +161,22 @@ protected function deleteEmptyFile(string $path, ConsoleIo $io): void { if (file_exists($path)) { unlink($path); - $io->out(sprintf('Deleted `%s`', $path), 1, ConsoleIo::QUIET); + $io->out(sprintf('Deleted `%s`', $path), 1, ConsoleIo::NORMAL); } } + + /** + * Check if a column name is valid. + * + * The Regex used here basically states that: + * - the column name has to start with an ASCII character (lower or upper case) or an underscore and + * - further characters are allowed to be either lower or upper case ASCII characters, numbers or underscores. + * + * @param string $name The name of the column. + * @return bool + */ + protected function isValidColumnName(string $name): bool + { + return (bool)preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $name); + } } diff --git a/app/vendor/cakephp/bake/src/Command/FixtureCommand.php b/app/vendor/cakephp/bake/src/Command/FixtureCommand.php index 1fd18493..69855d21 100644 --- a/app/vendor/cakephp/bake/src/Command/FixtureCommand.php +++ b/app/vendor/cakephp/bake/src/Command/FixtureCommand.php @@ -18,6 +18,7 @@ use Bake\Utility\TableScanner; use Bake\Utility\TemplateRenderer; +use Brick\VarExporter\VarExporter; use Cake\Console\Arguments; use Cake\Console\ConsoleIo; use Cake\Console\ConsoleOptionParser; @@ -72,6 +73,10 @@ public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionPar 'help' => 'When using generated data, the number of records to include in the fixture(s).', 'short' => 'n', 'default' => 1, + ])->addOption('fields', [ + 'help' => 'Create a fixture that includes the deprecated $fields property.', + 'short' => 'f', + 'boolean' => true, ])->addOption('schema', [ 'help' => 'Create a fixture that imports schema, instead of dumping a schema snapshot into the fixture.', 'short' => 's', @@ -162,6 +167,8 @@ protected function bake(string $model, string $useTable, Arguments $args, Consol $data = $this->readSchema($model, $useTable); } + $this->validateNames($data, $io); + if ($modelImport === null) { $schema = $this->_generateSchema($data); } @@ -202,13 +209,34 @@ public function readSchema(string $name, string $table): TableSchemaInterface return $model->getSchema(); } + /** + * Validates table and column names are supported. + * + * @param \Cake\Database\Schema\TableSchemaInterface $schema Table schema + * @param \Cake\Console\ConsoleIo $io Console io + * @return void + * @throws \Cake\Console\Exception\StopException When table or column names are not supported + */ + public function validateNames(TableSchemaInterface $schema, ConsoleIo $io): void + { + foreach ($schema->columns() as $column) { + if (!$this->isValidColumnName($column)) { + $io->abort(sprintf( + 'Unable to bake model. Table column name must start with a letter or underscore and + cannot contain special characters. Found `%s`.', + $column + )); + } + } + } + /** * Generate the fixture file, and write to disk * * @param \Cake\Console\Arguments $args The CLI arguments. * @param \Cake\Console\ConsoleIo $io The console io instance. * @param string $model name of the model being generated - * @param array $otherVars Contents of the fixture file. + * @param array $otherVars Contents of the fixture file. * @return void */ public function generateFixtureFile(Arguments $args, ConsoleIo $io, string $model, array $otherVars): void @@ -226,6 +254,9 @@ public function generateFixtureFile(Arguments $args, ConsoleIo $io, string $mode $defaults['namespace'] = $this->_pluginNamespace($this->plugin); } $vars = $otherVars + $defaults; + if (!$args->getOption('fields')) { + $vars['schema'] = null; + } $path = $this->getPath($args); $filename = $vars['name'] . 'Fixture.php'; @@ -235,7 +266,7 @@ public function generateFixtureFile(Arguments $args, ConsoleIo $io, string $mode $renderer->set($vars); $content = $renderer->generate('Bake.tests/fixture'); - $io->out("\n" . sprintf('Baking test fixture for %s...', $model), 1, ConsoleIo::QUIET); + $io->out("\n" . sprintf('Baking test fixture for %s...', $model), 1, ConsoleIo::NORMAL); $io->createFile($path . $filename, $content, $args->getOption('force')); $emptyFile = $path . '.gitkeep'; $this->deleteEmptyFile($emptyFile, $io); @@ -400,29 +431,19 @@ protected function _generateRecords(TableSchemaInterface $table, int $recordCoun * * @param array $records Array of records to be converted to string * @return string A string value of the $records array. + * @throws \Brick\VarExporter\ExportException */ protected function _makeRecordString(array $records): string { - $out = "[\n"; - foreach ($records as $record) { - $values = []; - foreach ($record as $field => $value) { + foreach ($records as &$record) { + array_walk($record, function (&$value) { if ($value instanceof DateTimeInterface) { $value = $value->format('Y-m-d H:i:s'); } - $val = var_export($value, true); - if ($val === 'NULL') { - $val = 'null'; - } - $values[] = " '$field' => $val"; - } - $out .= " [\n"; - $out .= implode(",\n", $values); - $out .= ",\n ],\n"; + }); } - $out .= ' ]'; - return $out; + return VarExporter::export($records, VarExporter::TRAILING_COMMA_IN_ARRAY, 2); } /** diff --git a/app/vendor/cakephp/bake/src/Command/ModelCommand.php b/app/vendor/cakephp/bake/src/Command/ModelCommand.php index 2be46282..d6a19b7d 100644 --- a/app/vendor/cakephp/bake/src/Command/ModelCommand.php +++ b/app/vendor/cakephp/bake/src/Command/ModelCommand.php @@ -22,7 +22,10 @@ use Cake\Console\ConsoleIo; use Cake\Console\ConsoleOptionParser; use Cake\Core\Configure; +use Cake\Database\Connection; +use Cake\Database\Driver\Sqlserver; use Cake\Database\Exception; +use Cake\Database\Schema\CachedCollection; use Cake\Database\Schema\TableSchema; use Cake\Database\Schema\TableSchemaInterface; use Cake\Datasource\ConnectionManager; @@ -78,6 +81,16 @@ public function execute(Arguments $args, ConsoleIo $io): ?int return static::CODE_SUCCESS; } + // Disable caching before baking with connection + $connection = ConnectionManager::get($this->connection); + if ($connection instanceof Connection) { + $collection = $connection->getSchemaCollection(); + if ($collection instanceof CachedCollection) { + $connection->getCacher()->clear(); + $connection->cacheMetadata(false); + } + } + $this->bake($this->_camelize($name), $args, $io); return static::CODE_SUCCESS; @@ -95,6 +108,7 @@ public function bake(string $name, Arguments $args, ConsoleIo $io): void { $table = $this->getTable($name, $args); $tableObject = $this->getTableObject($name, $table); + $this->validateNames($tableObject->getSchema(), $io); $data = $this->getTableContext($tableObject, $table, $name, $args, $io); $this->bakeTable($tableObject, $data, $args, $io); $this->bakeEntity($tableObject, $data, $args, $io); @@ -102,6 +116,27 @@ public function bake(string $name, Arguments $args, ConsoleIo $io): void $this->bakeTest($tableObject->getAlias(), $args, $io); } + /** + * Validates table and column names are supported. + * + * @param \Cake\Database\Schema\TableSchemaInterface $schema Table schema + * @param \Cake\Console\ConsoleIo $io Console io + * @return void + * @throws \Cake\Console\Exception\StopException When table or column names are not supported + */ + public function validateNames(TableSchemaInterface $schema, ConsoleIo $io): void + { + foreach ($schema->columns() as $column) { + if (!$this->isValidColumnName($column)) { + $io->abort(sprintf( + 'Unable to bake model. Table column name must start with a letter or underscore and + cannot contain special characters. Found `%s`.', + $column + )); + } + } + } + /** * Get table context for baking a given table. * @@ -472,16 +507,14 @@ public function findBelongsToMany(Table $model, array $associations): array * * @param \Cake\ORM\Table $model The model to introspect. * @param \Cake\Console\Arguments $args CLI Arguments - * @return string|null - * @psalm-suppress InvalidReturnType + * @return array|string|null */ - public function getDisplayField(Table $model, Arguments $args): ?string + public function getDisplayField(Table $model, Arguments $args) { if ($args->getOption('display-field')) { return (string)$args->getOption('display-field'); } - /** @psalm-suppress InvalidReturnStatement */ return $model->getDisplayField(); } @@ -650,14 +683,9 @@ public function getValidation(Table $model, array $associations, Arguments $args $validate = []; $primaryKey = $schema->getPrimaryKey(); - $foreignKeys = []; - if (isset($associations['belongsTo'])) { - foreach ($associations['belongsTo'] as $assoc) { - $foreignKeys[] = $assoc['foreignKey']; - } - } foreach ($fields as $fieldName) { - if (in_array($fieldName, $foreignKeys, true)) { + // Skip primary key + if (in_array($fieldName, $primaryKey, true)) { continue; } $field = $schema->getColumn($fieldName); @@ -676,7 +704,7 @@ public function getValidation(Table $model, array $associations, Arguments $args * @param \Cake\Database\Schema\TableSchemaInterface $schema The table schema for the current field. * @param string $fieldName Name of field to be validated. * @param array $metaData metadata for field - * @param array $primaryKey The primary key field + * @param array $primaryKey The primary key field. Unused because PK validation is skipped * @return array Array of validation for the field. */ public function fieldValidation( @@ -742,12 +770,7 @@ public function fieldValidation( ]; } - if (in_array($fieldName, $primaryKey, true)) { - $validation['allowEmpty'] = [ - 'rule' => $this->getEmptyMethod($fieldName, $metaData), - 'args' => [null, 'create'], - ]; - } elseif ($metaData['null'] === true) { + if ($metaData['null'] === true) { $validation['allowEmpty'] = [ 'rule' => $this->getEmptyMethod($fieldName, $metaData), 'args' => [], @@ -848,7 +871,7 @@ public function getRules(Table $model, array $associations, Arguments $args): ar $rules = []; foreach ($fields as $fieldName) { if (in_array($fieldName, $uniqueColumns, true)) { - $rules[$fieldName] = ['name' => 'isUnique']; + $rules[$fieldName] = ['name' => 'isUnique', 'fields' => [$fieldName], 'options' => []]; } } foreach ($schema->constraints() as $name) { @@ -856,10 +879,18 @@ public function getRules(Table $model, array $associations, Arguments $args): ar if ($constraint['type'] !== TableSchema::CONSTRAINT_UNIQUE) { continue; } - if (count($constraint['columns']) > 1) { - continue; + + $options = []; + $fields = $constraint['columns']; + foreach ($fields as $field) { + if ($schema->isNullable($field)) { + $allowMultiple = !ConnectionManager::get($this->connection)->getDriver() instanceof Sqlserver; + $options['allowMultipleNulls'] = $allowMultiple; + break; + } } - $rules[$constraint['columns'][0]] = ['name' => 'isUnique']; + + $rules[$constraint['columns'][0]] = ['name' => 'isUnique', 'fields' => $fields, 'options' => $options]; } if (empty($associations['belongsTo'])) { @@ -867,7 +898,7 @@ public function getRules(Table $model, array $associations, Arguments $args): ar } foreach ($associations['belongsTo'] as $assoc) { - $rules[$assoc['foreignKey']] = ['name' => 'existsIn', 'extra' => $assoc['alias']]; + $rules[$assoc['foreignKey']] = ['name' => 'existsIn', 'extra' => $assoc['alias'], 'options' => []]; } return $rules; @@ -977,7 +1008,7 @@ public function bakeEntity(Table $model, array $data, Arguments $args, ConsoleIo $path = $this->getPath($args); $filename = $path . 'Entity' . DS . $name . '.php'; - $io->out("\n" . sprintf('Baking entity class for %s...', $name), 1, ConsoleIo::QUIET); + $io->out("\n" . sprintf('Baking entity class for %s...', $name), 1, ConsoleIo::NORMAL); $io->createFile($filename, $out, $args->getOption('force')); $emptyFile = $path . 'Entity' . DS . '.gitkeep'; @@ -1029,7 +1060,7 @@ public function bakeTable(Table $model, array $data, Arguments $args, ConsoleIo $path = $this->getPath($args); $filename = $path . 'Table' . DS . $name . 'Table.php'; - $io->out("\n" . sprintf('Baking table class for %s...', $name), 1, ConsoleIo::QUIET); + $io->out("\n" . sprintf('Baking table class for %s...', $name), 1, ConsoleIo::NORMAL); $io->createFile($filename, $out, $args->getOption('force')); // Work around composer caching that classes/files do not exist. diff --git a/app/vendor/cakephp/bake/src/Command/PluginCommand.php b/app/vendor/cakephp/bake/src/Command/PluginCommand.php index 9cc30f27..2479e106 100644 --- a/app/vendor/cakephp/bake/src/Command/PluginCommand.php +++ b/app/vendor/cakephp/bake/src/Command/PluginCommand.php @@ -313,7 +313,7 @@ protected function _rootComposerFilePath(): string /** * find and change $this->path to the user selection * - * @param array $pathOptions The list of paths to look in. + * @param array $pathOptions The list of paths to look in. * @param \Cake\Console\ConsoleIo $io The io object * @return void */ @@ -412,7 +412,7 @@ public function findComposer(Arguments $args, ConsoleIo $io) /** * Search the $PATH for composer. * - * @param array $path The paths to search. + * @param array $path The paths to search. * @param \Cake\Console\ConsoleIo $io The console io * @return string|bool */ diff --git a/app/vendor/cakephp/bake/src/Command/SimpleBakeCommand.php b/app/vendor/cakephp/bake/src/Command/SimpleBakeCommand.php index 57489645..b48aa4a3 100644 --- a/app/vendor/cakephp/bake/src/Command/SimpleBakeCommand.php +++ b/app/vendor/cakephp/bake/src/Command/SimpleBakeCommand.php @@ -81,8 +81,6 @@ public function execute(Arguments $args, ConsoleIo $io): ?int if (empty($name)) { $io->err('You must provide a name to bake a ' . $this->name()); $this->abort(); - - return null; } $name = $this->_getName($name); $name = Inflector::camelize($name); diff --git a/app/vendor/cakephp/bake/src/Command/TemplateCommand.php b/app/vendor/cakephp/bake/src/Command/TemplateCommand.php index bb8bfd90..4b8ea362 100644 --- a/app/vendor/cakephp/bake/src/Command/TemplateCommand.php +++ b/app/vendor/cakephp/bake/src/Command/TemplateCommand.php @@ -64,6 +64,13 @@ class TemplateCommand extends BakeCommand */ public $scaffoldActions = ['index', 'view', 'add', 'edit']; + /** + * Actions that exclude hidden fields + * + * @var string[] + */ + public $excludeHiddenActions = ['index', 'view']; + /** * AssociationFilter utility * @@ -270,7 +277,7 @@ protected function _loadController(ConsoleIo $io): array $namespace = Configure::read('App.namespace'); $primaryKey = $displayField = $singularVar = $singularHumanName = null; - $schema = $fields = $modelClass = null; + $schema = $fields = $hidden = $modelClass = null; try { $primaryKey = (array)$modelObject->getPrimaryKey(); $displayField = $modelObject->getDisplayField(); @@ -278,6 +285,7 @@ protected function _loadController(ConsoleIo $io): array $singularHumanName = $this->_singularHumanName($this->controllerName); $schema = $modelObject->getSchema(); $fields = $schema->columns(); + $hidden = $modelObject->newEmptyEntity()->getHidden() ?: ['token', 'password', 'passwd']; $modelClass = $this->modelName; } catch (\Exception $exception) { $io->error($exception->getMessage()); @@ -312,6 +320,7 @@ protected function _loadController(ConsoleIo $io): array 'singularHumanName', 'pluralHumanName', 'fields', + 'hidden', 'associations', 'keyFields', 'namespace' @@ -325,7 +334,7 @@ protected function _loadController(ConsoleIo $io): array * @param \Cake\Console\ConsoleIo $io Console io * @param string $template Template file to use. * @param string|true $content Content to write. - * @param string $outputFile The output file to create. If null will use `$template` + * @param ?string $outputFile The output file to create. If null will use `$template` * @return void */ public function bake( @@ -349,7 +358,7 @@ public function bake( $path = $this->getTemplatePath($args); $filename = $path . Inflector::underscore($outputFile) . '.php'; - $io->out("\n" . sprintf('Baking `%s` view template file...', $outputFile), 1, ConsoleIo::QUIET); + $io->out("\n" . sprintf('Baking `%s` view template file...', $outputFile), 1, ConsoleIo::NORMAL); $io->createFile($filename, $content, $args->getOption('force')); } @@ -360,9 +369,9 @@ public function bake( * @param \Cake\Console\ConsoleIo $io The console io * @param string $action name to generate content to * @param array|null $vars passed for use in templates - * @return string|false Content from template + * @return string Content from template */ - public function getContent(Arguments $args, ConsoleIo $io, string $action, ?array $vars = null) + public function getContent(Arguments $args, ConsoleIo $io, string $action, ?array $vars = null): string { if (!$vars) { $vars = $this->_loadController($io); @@ -373,6 +382,10 @@ public function getContent(Arguments $args, ConsoleIo $io, string $action, ?arra $this->abort(); } + if (in_array($action, $this->excludeHiddenActions)) { + $vars['fields'] = array_diff($vars['fields'], $vars['hidden']); + } + $renderer = new TemplateRenderer($args->getOption('theme')); $renderer->set('action', $action); $renderer->set('plugin', $this->plugin); diff --git a/app/vendor/cakephp/bake/src/Command/TestCommand.php b/app/vendor/cakephp/bake/src/Command/TestCommand.php index abc84028..6158ec9b 100644 --- a/app/vendor/cakephp/bake/src/Command/TestCommand.php +++ b/app/vendor/cakephp/bake/src/Command/TestCommand.php @@ -57,6 +57,7 @@ class TestCommand extends BakeCommand 'Form' => 'Form', 'Mailer' => 'Mailer', 'Command' => 'Command', + 'CommandHelper' => 'Command\Helper', ]; /** @@ -78,6 +79,7 @@ class TestCommand extends BakeCommand 'Form' => 'Form', 'Mailer' => 'Mailer', 'Command' => 'Command', + 'CommandHelper' => 'Helper', ]; /** @@ -414,6 +416,7 @@ public function mapType(string $type): string * * @param string $className Name of class to look at. * @return string[] Array of method names. + * @throws \ReflectionException */ public function getTestableMethods(string $className): array { @@ -448,6 +451,7 @@ public function generateFixtureList($subject): array $this->_processController($subject); } + /** @psalm-suppress RedundantFunctionCall */ return array_values($this->_fixtures); } @@ -576,7 +580,7 @@ public function generateConstructor(string $type, string $fullClassName): array $pre .= " \$this->response = \$this->getMockBuilder('Cake\Http\Response')->getMock();"; $construct = "new {$className}(\$this->request, \$this->response);"; } - if ($type === 'ShellHelper') { + if ($type === 'ShellHelper' || $type === 'CommandHelper') { $pre = "\$this->stub = new ConsoleOutput();\n"; $pre .= ' $this->io = new ConsoleIo($this->stub);'; $construct = "new {$className}(\$this->io);"; @@ -626,6 +630,7 @@ public function generateProperties(string $type, string $subject, string $fullCl ]; break; + case 'CommandHelper': case 'ShellHelper': $properties[] = [ 'description' => 'ConsoleOutput stub', @@ -667,7 +672,7 @@ public function generateUses(string $type, string $fullClassName): array if ($type === 'Helper') { $uses[] = 'Cake\View\View'; } - if ($type === 'ShellHelper') { + if ($type === 'ShellHelper' || $type === 'CommandHelper') { $uses[] = 'Cake\TestSuite\Stub\ConsoleOutput'; $uses[] = 'Cake\Console\ConsoleIo'; } diff --git a/app/vendor/cakephp/bake/src/Plugin.php b/app/vendor/cakephp/bake/src/Plugin.php index 113e910f..f1a96a02 100644 --- a/app/vendor/cakephp/bake/src/Plugin.php +++ b/app/vendor/cakephp/bake/src/Plugin.php @@ -142,6 +142,7 @@ protected function findInPath(string $namespace, string $path): array if (!$hasSubfolder) { try { $reflection = new ReflectionClass($class); + /** @phpstan-ignore-next-line */ } catch (ReflectionException $e) { continue; } diff --git a/app/vendor/cakephp/bake/src/Utility/TemplateRenderer.php b/app/vendor/cakephp/bake/src/Utility/TemplateRenderer.php index 01c98c3c..bffec7ae 100644 --- a/app/vendor/cakephp/bake/src/Utility/TemplateRenderer.php +++ b/app/vendor/cakephp/bake/src/Utility/TemplateRenderer.php @@ -49,7 +49,7 @@ class TemplateRenderer /** * Constructor * - * @param string $theme The template theme/plugin to use. + * @param ?string $theme The template theme/plugin to use. */ public function __construct(?string $theme = '') { @@ -69,7 +69,7 @@ public function getView(): View } $this->viewBuilder() - ->setHelpers(['Bake.Bake', 'Bake.DocBlock']) + ->addhelpers(['Bake.Bake', 'Bake.DocBlock']) ->setTheme($this->theme); $view = $this->createView(BakeView::class); diff --git a/app/vendor/cakephp/bake/src/View/BakeView.php b/app/vendor/cakephp/bake/src/View/BakeView.php index 1a541971..b359c5e1 100644 --- a/app/vendor/cakephp/bake/src/View/BakeView.php +++ b/app/vendor/cakephp/bake/src/View/BakeView.php @@ -32,14 +32,6 @@ class BakeView extends TwigView */ public const BAKE_TEMPLATE_FOLDER = 'bake'; - /** - * Path where bake's intermediary files are written. - * Defaults to `TMP . 'bake' . DS`. - * - * @var string - */ - protected $_tmpLocation; - /** * @inheritDoc */ @@ -52,11 +44,6 @@ class BakeView extends TwigView */ public function initialize(): void { - $this->_tmpLocation = TMP . 'bake' . DS; - if (!file_exists($this->_tmpLocation)) { - mkdir($this->_tmpLocation); - } - $this->setConfig('environment', [ 'cache' => false, 'strict_variables' => Configure::read('Bake.twigStrictVariables', false), @@ -131,7 +118,7 @@ public function dispatchEvent(string $name, $data = null, $subject = null): Even /** * Return all possible paths to find view files in order * - * @param string $plugin Optional plugin name to scan for view files. + * @param ?string $plugin Optional plugin name to scan for view files. * @param bool $cached Set to false to force a refresh of view paths. Default true. * @return string[] paths */ diff --git a/app/vendor/cakephp/bake/src/View/Helper/BakeHelper.php b/app/vendor/cakephp/bake/src/View/Helper/BakeHelper.php index 99cdbb89..07ab0965 100644 --- a/app/vendor/cakephp/bake/src/View/Helper/BakeHelper.php +++ b/app/vendor/cakephp/bake/src/View/Helper/BakeHelper.php @@ -23,7 +23,7 @@ class BakeHelper extends Helper /** * Default configuration. * - * @var array + * @var array */ protected $_defaultConfig = []; @@ -39,7 +39,7 @@ class BakeHelper extends Helper * * @param string $name the name of the property * @param array $value the array of values - * @param array $options extra options to be passed to the element + * @param array $options extra options to be passed to the element * @return string */ public function arrayProperty(string $name, array $value = [], array $options = []): string @@ -63,7 +63,7 @@ public function arrayProperty(string $name, array $value = [], array $options = * Returns an array converted into a formatted multiline string * * @param array $list array of items to be stringified - * @param array $options options to use + * @param array $options options to use * @return string * @deprecated 2.5.0 Use BakeHelper::exportVar() instead. */ @@ -136,6 +136,7 @@ public function stringifyList(array $list, array $options = []): string * @param int $indentLevel Identation level. * @param int $options VarExporter option flags * @return string + * @throws \Brick\VarExporter\ExportException * @see https://github.com/brick/varexporter#options */ public function exportVar($var, int $indentLevel = 0, int $options = 0): string @@ -236,7 +237,7 @@ public function classInfo(string $class, string $type, string $suffix): array * @param \Cake\Datasource\SchemaInterface $schema Schema instance. * @param \Cake\ORM\Table|null $modelObject Model object. * @param string|int $takeFields Take fields. - * @param array $filterTypes Filter field types. + * @param array $filterTypes Filter field types. * @return array */ public function filterFields( @@ -244,7 +245,7 @@ public function filterFields( SchemaInterface $schema, ?Table $modelObject = null, $takeFields = 0, - $filterTypes = ['binary'] + array $filterTypes = ['binary'] ): array { $fields = collection($fields) ->filter(function ($field) use ($schema, $filterTypes) { diff --git a/app/vendor/cakephp/bake/src/View/Helper/DocBlockHelper.php b/app/vendor/cakephp/bake/src/View/Helper/DocBlockHelper.php index ffc1d052..456396bc 100644 --- a/app/vendor/cakephp/bake/src/View/Helper/DocBlockHelper.php +++ b/app/vendor/cakephp/bake/src/View/Helper/DocBlockHelper.php @@ -26,7 +26,7 @@ class DocBlockHelper extends Helper * * @param string $className The class this comment block is for. * @param string $classType The type of class (example, Entity) - * @param array $annotations An array of PHP comment block annotations. + * @param array $annotations An array of PHP comment block annotations. * @return string The DocBlock for a class header. */ public function classDescription(string $className, string $classType, array $annotations): string diff --git a/app/vendor/cakephp/bake/templates/bake/Controller/component.twig b/app/vendor/cakephp/bake/templates/bake/Controller/component.twig index b032bfb3..d4e3f95d 100644 --- a/app/vendor/cakephp/bake/templates/bake/Controller/component.twig +++ b/app/vendor/cakephp/bake/templates/bake/Controller/component.twig @@ -29,7 +29,7 @@ class {{ name }}Component extends Component /** * Default configuration. * - * @var array + * @var array */ protected $_defaultConfig = []; } diff --git a/app/vendor/cakephp/bake/templates/bake/Model/behavior.twig b/app/vendor/cakephp/bake/templates/bake/Model/behavior.twig index c536fedd..a6ff121d 100644 --- a/app/vendor/cakephp/bake/templates/bake/Model/behavior.twig +++ b/app/vendor/cakephp/bake/templates/bake/Model/behavior.twig @@ -29,7 +29,7 @@ class {{ name }}Behavior extends Behavior /** * Default configuration. * - * @var array + * @var array */ protected $_defaultConfig = []; } diff --git a/app/vendor/cakephp/bake/templates/bake/Model/entity.twig b/app/vendor/cakephp/bake/templates/bake/Model/entity.twig index 6dd3cdb7..e7798c30 100644 --- a/app/vendor/cakephp/bake/templates/bake/Model/entity.twig +++ b/app/vendor/cakephp/bake/templates/bake/Model/entity.twig @@ -41,7 +41,7 @@ class {{ name }} extends Entity * be mass assigned. For security purposes, it is advised to set '*' to false * (or remove it), and explicitly make individual fields accessible as needed. * - * @var array + * @var array */ protected $_accessible = {{ Bake.exportVar(accessible, 1)|raw }}; {% endif %} @@ -52,7 +52,7 @@ class {{ name }} extends Entity /** * Fields that are excluded from JSON versions of the entity. * - * @var array + * @var array */ protected $_hidden = {{ Bake.exportVar(hidden, 1)|raw }}; {% endif %} diff --git a/app/vendor/cakephp/bake/templates/bake/Model/table.twig b/app/vendor/cakephp/bake/templates/bake/Model/table.twig index edd58d34..7bbeff11 100644 --- a/app/vendor/cakephp/bake/templates/bake/Model/table.twig +++ b/app/vendor/cakephp/bake/templates/bake/Model/table.twig @@ -40,7 +40,7 @@ class {{ name }}Table extends Table {% endif %} {%- if displayField %} - $this->setDisplayField('{{ displayField }}'); + $this->setDisplayField({{ (displayField is iterable ? Bake.exportArray(displayField) : Bake.exportVar(displayField))|raw }}); {% endif %} {%- if primaryKey %} @@ -119,7 +119,12 @@ class {{ name }}Table extends Table public function buildRules(RulesChecker $rules): RulesChecker { {% for field, rule in rulesChecker %} - $rules->add($rules->{{ rule.name }}(['{{ field }}']{{ (rule.extra is defined and rule.extra ? (", '#{rule.extra}'") : '')|raw }}), ['errorField' => '{{ field }}']); +{% set fields = rule.fields is defined ? Bake.exportArray(rule.fields) : Bake.exportVar(field) %} +{% set options = '' %} +{% for optionName, optionValue in rule.options %} + {%~ set options = (loop.first ? '[' : options) ~ "'#{optionName}' => " ~ Bake.exportVar(optionValue) ~ (loop.last ? ']' : ', ') %} +{% endfor %} + $rules->add($rules->{{ rule.name }}({{ fields|raw }}{{ (rule.extra|default ? ", '#{rule.extra}'" : '')|raw }}{{ (options ? ', ' ~ options : '')|raw }}), ['errorField' => '{{ field }}']); {% endfor %} return $rules; diff --git a/app/vendor/cakephp/bake/templates/bake/Plugin/phpunit.xml.dist.twig b/app/vendor/cakephp/bake/templates/bake/Plugin/phpunit.xml.dist.twig index 2653e666..3736109e 100644 --- a/app/vendor/cakephp/bake/templates/bake/Plugin/phpunit.xml.dist.twig +++ b/app/vendor/cakephp/bake/templates/bake/Plugin/phpunit.xml.dist.twig @@ -32,19 +32,14 @@ - - - - - - - - + + + + src/ - diff --git a/app/vendor/cakephp/bake/templates/bake/Plugin/src/Plugin.php.twig b/app/vendor/cakephp/bake/templates/bake/Plugin/src/Plugin.php.twig index 74b45675..f39d042f 100644 --- a/app/vendor/cakephp/bake/templates/bake/Plugin/src/Plugin.php.twig +++ b/app/vendor/cakephp/bake/templates/bake/Plugin/src/Plugin.php.twig @@ -19,9 +19,11 @@ declare(strict_types=1); namespace {{ namespace }}; use Cake\Core\BasePlugin; +use Cake\Core\ContainerInterface; use Cake\Core\PluginApplicationInterface; use Cake\Http\MiddlewareQueue; use Cake\Routing\RouteBuilder; +use Cake\Console\CommandCollection; /** * Plugin for {{ namespace }} @@ -67,7 +69,7 @@ class Plugin extends BasePlugin /** * Add middleware for the plugin. * - * @param \Cake\Http\MiddlewareQueue $middleware The middleware queue to update. + * @param \Cake\Http\MiddlewareQueue $middlewareQueue The middleware queue to update. * @return \Cake\Http\MiddlewareQueue */ public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue @@ -76,4 +78,31 @@ class Plugin extends BasePlugin return $middlewareQueue; } + + /** + * Add commands for the plugin. + * + * @param \Cake\Console\CommandCollection $commands The command collection to update. + * @return \Cake\Console\CommandCollection + */ + public function console(CommandCollection $commands) : CommandCollection + { + // Add your commands here + + $commands = parent::console($commands); + + return $commands; + } + + /** + * Register application container services. + * + * @param \Cake\Core\ContainerInterface $container The Container to update. + * @return void + * @link https://book.cakephp.org/4/en/development/dependency-injection.html#dependency-injection + */ + public function services(ContainerInterface $container): void + { + // Add your services here + } } diff --git a/app/vendor/cakephp/bake/templates/bake/Plugin/tests/bootstrap.php.twig b/app/vendor/cakephp/bake/templates/bake/Plugin/tests/bootstrap.php.twig index bfad9f66..07b207ba 100644 --- a/app/vendor/cakephp/bake/templates/bake/Plugin/tests/bootstrap.php.twig +++ b/app/vendor/cakephp/bake/templates/bake/Plugin/tests/bootstrap.php.twig @@ -55,3 +55,18 @@ if (file_exists($root . '/config/bootstrap.php')) { return; } + +/** + * Load schema from a SQL dump file. + * + * If your plugin does not use database fixtures you can + * safely delete this. + * + * If you want to support multiple databases, consider + * using migrations to provide schema for your plugin, + * and using \Migrations\TestSuite\Migrator to load schema. + */ +use Cake\TestSuite\Schema\SchemaManager; + +// Load a schema dump file. +SchemaManager::create('test', 'tests/schema.sql'); diff --git a/app/vendor/cakephp/bake/templates/bake/Shell/helper.twig b/app/vendor/cakephp/bake/templates/bake/Shell/helper.twig index 0d1320d7..171b4cfa 100644 --- a/app/vendor/cakephp/bake/templates/bake/Shell/helper.twig +++ b/app/vendor/cakephp/bake/templates/bake/Shell/helper.twig @@ -30,9 +30,10 @@ class {{ name }}Helper extends Helper * * Generate the output for this shell helper. * + * @param array $args Arguments. * @return void */ - public function output($args) + public function output(array $args): void { } } diff --git a/app/vendor/cakephp/bake/templates/bake/Template/index.twig b/app/vendor/cakephp/bake/templates/bake/Template/index.twig index 49c8cc38..0f64f3c4 100644 --- a/app/vendor/cakephp/bake/templates/bake/Template/index.twig +++ b/app/vendor/cakephp/bake/templates/bake/Template/index.twig @@ -51,6 +51,8 @@ {% set columnData = Bake.columnData(field, schema) %} {% if columnData.type not in ['integer', 'float', 'decimal', 'biginteger', 'smallinteger', 'tinyinteger'] %} {{ field }}) ?> +{% elseif columnData.null %} + {{ field }} === null ? '' : $this->Number->format(${{ singularVar }}->{{ field }}) ?> {% else %} Number->format(${{ singularVar }}->{{ field }}) ?> {% endif %} diff --git a/app/vendor/cakephp/bake/templates/bake/Template/view.twig b/app/vendor/cakephp/bake/templates/bake/Template/view.twig index c2349dfd..a709dd12 100644 --- a/app/vendor/cakephp/bake/templates/bake/Template/view.twig +++ b/app/vendor/cakephp/bake/templates/bake/Template/view.twig @@ -67,7 +67,12 @@ {% for field in groupedFields.number %} +{% set columnData = Bake.columnData(field, schema) %} +{% if columnData.null %} + {{ field }} === null ? '' : $this->Number->format(${{ singularVar }}->{{ field }}) ?> +{% else %} Number->format(${{ singularVar }}->{{ field }}) ?> +{% endif %} {% endfor %} {% endif %} diff --git a/app/vendor/cakephp/bake/templates/bake/View/cell.twig b/app/vendor/cakephp/bake/templates/bake/View/cell.twig index 477ca17b..6ba66be8 100644 --- a/app/vendor/cakephp/bake/templates/bake/View/cell.twig +++ b/app/vendor/cakephp/bake/templates/bake/View/cell.twig @@ -29,7 +29,7 @@ class {{ name }}Cell extends Cell * List of valid options that can be passed into this * cell's constructor. * - * @var array + * @var array */ protected $_validCellOptions = []; diff --git a/app/vendor/cakephp/bake/templates/bake/View/helper.twig b/app/vendor/cakephp/bake/templates/bake/View/helper.twig index 1c2c3bba..f39ae2fd 100644 --- a/app/vendor/cakephp/bake/templates/bake/View/helper.twig +++ b/app/vendor/cakephp/bake/templates/bake/View/helper.twig @@ -29,7 +29,7 @@ class {{ name }}Helper extends Helper /** * Default configuration. * - * @var array + * @var array */ protected $_defaultConfig = []; diff --git a/app/vendor/cakephp/bake/templates/bake/element/Controller/add.twig b/app/vendor/cakephp/bake/templates/bake/element/Controller/add.twig index 37d36e7f..6dc3ab66 100644 --- a/app/vendor/cakephp/bake/templates/bake/element/Controller/add.twig +++ b/app/vendor/cakephp/bake/templates/bake/element/Controller/add.twig @@ -37,7 +37,7 @@ {%- for assoc in associations %} {%- set otherName = Bake.getAssociatedTableAlias(modelObj, assoc) %} {%- set otherPlural = otherName|variable %} - ${{ otherPlural }} = $this->{{ currentModelName }}->{{ otherName }}->find('list', ['limit' => 200]); + ${{ otherPlural }} = $this->{{ currentModelName }}->{{ otherName }}->find('list', ['limit' => 200])->all(); {{- "\n" }} {%- set compact = compact|merge(["'#{otherPlural}'"]) %} {% endfor %} diff --git a/app/vendor/cakephp/bake/templates/bake/element/Controller/edit.twig b/app/vendor/cakephp/bake/templates/bake/element/Controller/edit.twig index b29da3b6..13e10e2d 100644 --- a/app/vendor/cakephp/bake/templates/bake/element/Controller/edit.twig +++ b/app/vendor/cakephp/bake/templates/bake/element/Controller/edit.twig @@ -40,7 +40,7 @@ {% for assoc in belongsTo|merge(belongsToMany) %} {%- set otherName = Bake.getAssociatedTableAlias(modelObj, assoc) %} {%- set otherPlural = otherName|variable %} - ${{ otherPlural }} = $this->{{ currentModelName }}->{{ otherName }}->find('list', ['limit' => 200]); + ${{ otherPlural }} = $this->{{ currentModelName }}->{{ otherName }}->find('list', ['limit' => 200])->all(); {{- "\n" }} {%- set compact = compact|merge(["'#{otherPlural}'"]) %} {% endfor %} diff --git a/app/vendor/cakephp/bake/templates/bake/tests/fixture.twig b/app/vendor/cakephp/bake/templates/bake/tests/fixture.twig index 131fa18f..f1f64851 100644 --- a/app/vendor/cakephp/bake/templates/bake/tests/fixture.twig +++ b/app/vendor/cakephp/bake/templates/bake/tests/fixture.twig @@ -42,7 +42,7 @@ class {{ name }}Fixture extends TestFixture /** * Import * - * @var array + * @var array */ public $import = {{ import|raw }}; @@ -52,7 +52,7 @@ class {{ name }}Fixture extends TestFixture /** * Fields * - * @var array + * @var array */ // phpcs:disable public $fields = {{ schema|raw }}; diff --git a/app/vendor/cakephp/bake/templates/bake/tests/test_case.twig b/app/vendor/cakephp/bake/templates/bake/tests/test_case.twig index 0ca9bc30..31d413e8 100644 --- a/app/vendor/cakephp/bake/templates/bake/tests/test_case.twig +++ b/app/vendor/cakephp/bake/templates/bake/tests/test_case.twig @@ -74,7 +74,7 @@ class {{ className }}Test extends TestCase /** * Fixtures * - * @var array + * @var array */ protected $fixtures = {{ Bake.exportVar(fixtures|values, 1)|raw }}; {% if construction or methods %} @@ -88,7 +88,7 @@ class {{ className }}Test extends TestCase * * @return void */ - public function setUp(): void + protected function setUp(): void { parent::setUp(); {% if preConstruct %} @@ -110,7 +110,7 @@ class {{ className }}Test extends TestCase * * @return void */ - public function tearDown(): void + protected function tearDown(): void { unset($this->{{ subject }}); diff --git a/app/vendor/cakephp/bake/tests/Fixture/BakeArticlesBakeTagsFixture.php b/app/vendor/cakephp/bake/tests/Fixture/BakeArticlesBakeTagsFixture.php index f2ab05cd..2b26ee9f 100644 --- a/app/vendor/cakephp/bake/tests/Fixture/BakeArticlesBakeTagsFixture.php +++ b/app/vendor/cakephp/bake/tests/Fixture/BakeArticlesBakeTagsFixture.php @@ -24,7 +24,7 @@ class BakeArticlesBakeTagsFixture extends TestFixture /** * fields property * - * @var array + * @var array */ public $fields = [ 'bake_article_id' => ['type' => 'integer', 'null' => false], diff --git a/app/vendor/cakephp/bake/tests/Fixture/BakeArticlesFixture.php b/app/vendor/cakephp/bake/tests/Fixture/BakeArticlesFixture.php index dd758ae8..4578b6b9 100644 --- a/app/vendor/cakephp/bake/tests/Fixture/BakeArticlesFixture.php +++ b/app/vendor/cakephp/bake/tests/Fixture/BakeArticlesFixture.php @@ -24,7 +24,7 @@ class BakeArticlesFixture extends TestFixture /** * fields property * - * @var array + * @var array */ public $fields = [ 'id' => ['type' => 'integer'], diff --git a/app/vendor/cakephp/bake/tests/Fixture/BakeCarFixture.php b/app/vendor/cakephp/bake/tests/Fixture/BakeCarFixture.php index 5ec27b45..1270c047 100644 --- a/app/vendor/cakephp/bake/tests/Fixture/BakeCarFixture.php +++ b/app/vendor/cakephp/bake/tests/Fixture/BakeCarFixture.php @@ -29,7 +29,7 @@ class BakeCarFixture extends TestFixture /** * fields property * - * @var array + * @var array */ public $fields = [ 'id' => ['type' => 'integer'], diff --git a/app/vendor/cakephp/bake/tests/Fixture/BakeCommentsFixture.php b/app/vendor/cakephp/bake/tests/Fixture/BakeCommentsFixture.php index 69a663d2..29faa0d0 100644 --- a/app/vendor/cakephp/bake/tests/Fixture/BakeCommentsFixture.php +++ b/app/vendor/cakephp/bake/tests/Fixture/BakeCommentsFixture.php @@ -24,7 +24,7 @@ class BakeCommentsFixture extends TestFixture /** * fields property * - * @var array + * @var array */ public $fields = [ 'otherid' => ['type' => 'integer'], diff --git a/app/vendor/cakephp/bake/tests/Fixture/BakeTagsFixture.php b/app/vendor/cakephp/bake/tests/Fixture/BakeTagsFixture.php index 5f320927..d25588a2 100644 --- a/app/vendor/cakephp/bake/tests/Fixture/BakeTagsFixture.php +++ b/app/vendor/cakephp/bake/tests/Fixture/BakeTagsFixture.php @@ -24,7 +24,7 @@ class BakeTagsFixture extends TestFixture /** * fields property * - * @var array + * @var array */ public $fields = [ 'id' => ['type' => 'integer'], diff --git a/app/vendor/cakephp/bake/tests/Fixture/BakeTemplateAuthorsFixture.php b/app/vendor/cakephp/bake/tests/Fixture/BakeTemplateAuthorsFixture.php index 48170c9e..557bca56 100644 --- a/app/vendor/cakephp/bake/tests/Fixture/BakeTemplateAuthorsFixture.php +++ b/app/vendor/cakephp/bake/tests/Fixture/BakeTemplateAuthorsFixture.php @@ -23,7 +23,7 @@ class BakeTemplateAuthorsFixture extends TestFixture { /** - * Avoid overriding core.authors + * Avoid overriding AuthorsFixture's table. * * @var string */ @@ -32,7 +32,7 @@ class BakeTemplateAuthorsFixture extends TestFixture /** * fields property * - * @var array + * @var array */ public $fields = [ 'id' => ['type' => 'integer'], diff --git a/app/vendor/cakephp/bake/tests/Fixture/BakeTemplateProfilesFixture.php b/app/vendor/cakephp/bake/tests/Fixture/BakeTemplateProfilesFixture.php index 84ae5080..fd112e18 100644 --- a/app/vendor/cakephp/bake/tests/Fixture/BakeTemplateProfilesFixture.php +++ b/app/vendor/cakephp/bake/tests/Fixture/BakeTemplateProfilesFixture.php @@ -32,7 +32,7 @@ class BakeTemplateProfilesFixture extends TestFixture /** * fields property * - * @var array + * @var array */ public $fields = [ 'id' => ['type' => 'integer'], diff --git a/app/vendor/cakephp/bake/tests/Fixture/BakeTemplateRolesFixture.php b/app/vendor/cakephp/bake/tests/Fixture/BakeTemplateRolesFixture.php index 2a4f5be8..60654c82 100644 --- a/app/vendor/cakephp/bake/tests/Fixture/BakeTemplateRolesFixture.php +++ b/app/vendor/cakephp/bake/tests/Fixture/BakeTemplateRolesFixture.php @@ -29,7 +29,7 @@ class BakeTemplateRolesFixture extends TestFixture /** * fields property * - * @var array + * @var array */ public $fields = [ 'id' => ['type' => 'integer'], diff --git a/app/vendor/cakephp/bake/tests/Fixture/BinaryTestsFixture.php b/app/vendor/cakephp/bake/tests/Fixture/BinaryTestsFixture.php index 09281529..bbd9d73a 100644 --- a/app/vendor/cakephp/bake/tests/Fixture/BinaryTestsFixture.php +++ b/app/vendor/cakephp/bake/tests/Fixture/BinaryTestsFixture.php @@ -24,7 +24,7 @@ class BinaryTestsFixture extends TestFixture /** * fields property * - * @var array + * @var array */ public $fields = [ 'id' => ['type' => 'integer'], diff --git a/app/vendor/cakephp/bake/tests/Fixture/CategoryThreadsFixture.php b/app/vendor/cakephp/bake/tests/Fixture/CategoryThreadsFixture.php index 21ff2518..314dcac9 100644 --- a/app/vendor/cakephp/bake/tests/Fixture/CategoryThreadsFixture.php +++ b/app/vendor/cakephp/bake/tests/Fixture/CategoryThreadsFixture.php @@ -24,7 +24,7 @@ class CategoryThreadsFixture extends TestFixture /** * fields property * - * @var array + * @var array */ public $fields = [ 'id' => ['type' => 'integer'], diff --git a/app/vendor/cakephp/bake/tests/Fixture/DatatypesFixture.php b/app/vendor/cakephp/bake/tests/Fixture/DatatypesFixture.php index 62031565..573b6159 100644 --- a/app/vendor/cakephp/bake/tests/Fixture/DatatypesFixture.php +++ b/app/vendor/cakephp/bake/tests/Fixture/DatatypesFixture.php @@ -24,7 +24,7 @@ class DatatypesFixture extends TestFixture /** * Fields property * - * @var array + * @var array */ public $fields = [ 'id' => ['type' => 'integer', 'null' => false], @@ -35,6 +35,7 @@ class DatatypesFixture extends TestFixture 'tiny_int' => ['type' => 'tinyinteger'], 'bool' => ['type' => 'boolean', 'null' => false, 'default' => false], 'uuid' => ['type' => 'uuid'], + 'timestamp_field' => ['type' => 'timestamp'], '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]], ]; @@ -44,6 +45,6 @@ class DatatypesFixture extends TestFixture * @var array */ public $records = [ - ['float_field' => 42.23, 'huge_int' => '1234567891234567891', 'small_int' => '1234', 'tiny_int' => '12', 'bool' => 0], + ['decimal_field' => '30.123', 'float_field' => 42.23, 'huge_int' => '1234567891234567891', 'small_int' => '1234', 'tiny_int' => '12', 'bool' => 0, 'timestamp_field' => '2007-03-17 01:16:23'], ]; } diff --git a/app/vendor/cakephp/bake/tests/Fixture/InvitationsFixture.php b/app/vendor/cakephp/bake/tests/Fixture/InvitationsFixture.php index 976fbe0a..0a6c2dab 100644 --- a/app/vendor/cakephp/bake/tests/Fixture/InvitationsFixture.php +++ b/app/vendor/cakephp/bake/tests/Fixture/InvitationsFixture.php @@ -24,7 +24,7 @@ class InvitationsFixture extends TestFixture /** * fields property * - * @var array + * @var array */ public $fields = [ 'id' => ['type' => 'integer'], diff --git a/app/vendor/cakephp/bake/tests/Fixture/NumberTreesFixture.php b/app/vendor/cakephp/bake/tests/Fixture/NumberTreesFixture.php index cd5ffd27..5081adc9 100644 --- a/app/vendor/cakephp/bake/tests/Fixture/NumberTreesFixture.php +++ b/app/vendor/cakephp/bake/tests/Fixture/NumberTreesFixture.php @@ -26,7 +26,7 @@ class NumberTreesFixture extends TestFixture /** * fields property * - * @var array + * @var array */ public $fields = [ 'id' => ['type' => 'integer'], diff --git a/app/vendor/cakephp/bake/tests/Fixture/TodoItemsFixture.php b/app/vendor/cakephp/bake/tests/Fixture/TodoItemsFixture.php index ec3cc45d..f9531b77 100644 --- a/app/vendor/cakephp/bake/tests/Fixture/TodoItemsFixture.php +++ b/app/vendor/cakephp/bake/tests/Fixture/TodoItemsFixture.php @@ -27,7 +27,7 @@ class TodoItemsFixture extends TestFixture /** * fields property * - * @var array + * @var array */ public $fields = [ 'id' => ['type' => 'integer', 'null' => false], diff --git a/app/vendor/cakephp/bake/tests/Fixture/TodoItemsTodoLabelsFixture.php b/app/vendor/cakephp/bake/tests/Fixture/TodoItemsTodoLabelsFixture.php index 67a4b9c1..828baa5b 100644 --- a/app/vendor/cakephp/bake/tests/Fixture/TodoItemsTodoLabelsFixture.php +++ b/app/vendor/cakephp/bake/tests/Fixture/TodoItemsTodoLabelsFixture.php @@ -27,7 +27,7 @@ class TodoItemsTodoLabelsFixture extends TestFixture /** * fields property * - * @var array + * @var array */ public $fields = [ 'todo_item_id' => ['type' => 'integer', 'null' => false], diff --git a/app/vendor/cakephp/bake/tests/Fixture/TodoLabelsFixture.php b/app/vendor/cakephp/bake/tests/Fixture/TodoLabelsFixture.php index e21cde1c..6158c0f2 100644 --- a/app/vendor/cakephp/bake/tests/Fixture/TodoLabelsFixture.php +++ b/app/vendor/cakephp/bake/tests/Fixture/TodoLabelsFixture.php @@ -27,7 +27,7 @@ class TodoLabelsFixture extends TestFixture /** * fields property * - * @var array + * @var array */ public $fields = [ 'id' => ['type' => 'integer'], diff --git a/app/vendor/cakephp/bake/tests/Fixture/TodoTasksFixture.php b/app/vendor/cakephp/bake/tests/Fixture/TodoTasksFixture.php index f8f34a85..c715ad81 100644 --- a/app/vendor/cakephp/bake/tests/Fixture/TodoTasksFixture.php +++ b/app/vendor/cakephp/bake/tests/Fixture/TodoTasksFixture.php @@ -27,7 +27,7 @@ class TodoTasksFixture extends TestFixture /** * fields property * - * @var array + * @var array */ public $fields = [ 'uid' => ['type' => 'integer'], diff --git a/app/vendor/cakephp/bake/tests/Fixture/UsersFixture.php b/app/vendor/cakephp/bake/tests/Fixture/UsersFixture.php index 7dbd989f..259ef06c 100644 --- a/app/vendor/cakephp/bake/tests/Fixture/UsersFixture.php +++ b/app/vendor/cakephp/bake/tests/Fixture/UsersFixture.php @@ -24,7 +24,7 @@ class UsersFixture extends TestFixture /** * fields property * - * @var array + * @var array */ public $fields = [ 'id' => ['type' => 'integer'], diff --git a/app/vendor/cakephp/bake/tests/bootstrap.php b/app/vendor/cakephp/bake/tests/bootstrap.php index 4c4e3d14..e214799c 100644 --- a/app/vendor/cakephp/bake/tests/bootstrap.php +++ b/app/vendor/cakephp/bake/tests/bootstrap.php @@ -20,6 +20,8 @@ use Cake\Core\Configure; use Cake\Core\Plugin; use Cake\Datasource\ConnectionManager; +use Cake\Error\Debug\TextFormatter; +use Cake\TestSuite\Fixture\SchemaLoader; $findRoot = function ($root) { do { @@ -75,4 +77,12 @@ } ConnectionManager::setConfig('test', ['url' => getenv('DB_URL')]); +// Create test database schema +if (env('FIXTURE_SCHEMA_METADATA')) { + $loader = new SchemaLoader(); + $loader->loadInternalFile(env('FIXTURE_SCHEMA_METADATA')); +} + +Configure::write('Debugger.exportFormatter', TextFormatter::class); + Plugin::getCollection()->add(new \Bake\Plugin()); diff --git a/app/vendor/cakephp/cakephp-codesniffer/.github/workflows/ci.yml b/app/vendor/cakephp/cakephp-codesniffer/.github/workflows/ci.yml index 84355bcb..f3149de5 100644 --- a/app/vendor/cakephp/cakephp-codesniffer/.github/workflows/ci.yml +++ b/app/vendor/cakephp/cakephp-codesniffer/.github/workflows/ci.yml @@ -21,9 +21,7 @@ jobs: prefer-lowest: 'prefer-lowest' steps: - - uses: actions/checkout@v1 - with: - fetch-depth: 1 + - uses: actions/checkout@v2 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -49,11 +47,11 @@ jobs: - name: Composer Install run: | if [[ ${{ matrix.php-version }} == '8.0' ]]; then - composer update --ignore-platform-reqs + composer install --ignore-platform-reqs elif ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then composer update --prefer-lowest --prefer-stable else - composer update + composer install fi - name: Configure PHPUnit matcher @@ -74,15 +72,14 @@ jobs: runs-on: ubuntu-18.04 steps: - - uses: actions/checkout@v1 - with: - fetch-depth: 1 + - uses: actions/checkout@v2 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: '7.2' extensions: mbstring, intl + tools: cs2pr coverage: none - name: Get composer cache directory @@ -100,7 +97,7 @@ jobs: key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }} - name: Composer install - run: composer update + run: composer install - name: Run PHP CodeSniffer - run: vendor/bin/phpcs --report=checkstyle CakePHP/ + run: vendor/bin/phpcs --report=checkstyle CakePHP/ | cs2pr diff --git a/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/Classes/ReturnTypeHintSniff.php b/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/Classes/ReturnTypeHintSniff.php index a0267fa7..9f1764ca 100644 --- a/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/Classes/ReturnTypeHintSniff.php +++ b/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/Classes/ReturnTypeHintSniff.php @@ -61,13 +61,13 @@ public function process(File $phpcsFile, $stackPtr) return []; } - $returnTokenType = $tokens[$startIndex]['type']; - if ($returnTokenType !== 'T_SELF') { + $returnTokenCode = $tokens[$startIndex]['code']; + if ($returnTokenCode !== T_SELF) { // Then we can only warn, but not auto-fix $phpcsFile->addError( 'Chaining methods (@return $this) should not have any return-type-hint.', $startIndex, - 'TypeHint.Invalid.Self' + 'InvalidSelf' ); return; @@ -76,7 +76,7 @@ public function process(File $phpcsFile, $stackPtr) $fix = $phpcsFile->addFixableError( 'Chaining methods (@return $this) should not have any return-type-hint (Remove "self").', $startIndex, - 'TypeHint.Invalid.Self' + 'InvalidSelf' ); if (!$fix) { return; @@ -107,7 +107,7 @@ protected function isChainingMethod(File $phpCsFile, int $stackPointer): bool $docBlockStartIndex = $tokens[$docBlockEndIndex]['comment_opener']; for ($i = $docBlockStartIndex + 1; $i < $docBlockEndIndex; $i++) { - if ($tokens[$i]['type'] !== 'T_DOC_COMMENT_TAG') { + if ($tokens[$i]['code'] !== T_DOC_COMMENT_TAG) { continue; } if ($tokens[$i]['content'] !== '@return') { @@ -116,7 +116,7 @@ protected function isChainingMethod(File $phpCsFile, int $stackPointer): bool $classNameIndex = $i + 2; - if ($tokens[$classNameIndex]['type'] !== 'T_DOC_COMMENT_STRING') { + if ($tokens[$classNameIndex]['code'] !== T_DOC_COMMENT_STRING) { continue; } @@ -149,7 +149,7 @@ protected function assertNotThisOrStatic(File $phpCsFile, int $stackPointer): vo $docBlockStartIndex = $tokens[$docBlockEndIndex]['comment_opener']; for ($i = $docBlockStartIndex + 1; $i < $docBlockEndIndex; $i++) { - if ($tokens[$i]['type'] !== 'T_DOC_COMMENT_TAG') { + if ($tokens[$i]['code'] !== T_DOC_COMMENT_TAG) { continue; } if ($tokens[$i]['content'] !== '@return') { @@ -158,7 +158,7 @@ protected function assertNotThisOrStatic(File $phpCsFile, int $stackPointer): vo $classNameIndex = $i + 2; - if ($tokens[$classNameIndex]['type'] !== 'T_DOC_COMMENT_STRING') { + if ($tokens[$classNameIndex]['code'] !== T_DOC_COMMENT_STRING) { continue; } @@ -175,7 +175,7 @@ protected function assertNotThisOrStatic(File $phpCsFile, int $stackPointer): vo $phpCsFile->addError( 'Class name repeated, expected `self` or `$this`.', $classNameIndex, - 'TypeHint.Invalid.Class' + 'InvalidClass' ); } } @@ -197,14 +197,14 @@ protected function findRelatedDocBlock(File $phpCsFile, int $stackPointer): ?int if ( !empty($tokens[$beginningOfLine - 2]) - && $tokens[$beginningOfLine - 2]['type'] === 'T_DOC_COMMENT_CLOSE_TAG' + && $tokens[$beginningOfLine - 2]['code'] === T_DOC_COMMENT_CLOSE_TAG ) { return $beginningOfLine - 2; } if ( !empty($tokens[$beginningOfLine - 3]) - && $tokens[$beginningOfLine - 3]['type'] === 'T_DOC_COMMENT_CLOSE_TAG' + && $tokens[$beginningOfLine - 3]['code'] === T_DOC_COMMENT_CLOSE_TAG ) { return $beginningOfLine - 3; } diff --git a/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/Commenting/DocBlockAlignmentSniff.php b/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/Commenting/DocBlockAlignmentSniff.php index 5e75161b..9d651c2a 100644 --- a/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/Commenting/DocBlockAlignmentSniff.php +++ b/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/Commenting/DocBlockAlignmentSniff.php @@ -74,7 +74,7 @@ public function process(File $phpcsFile, $stackPtr) $phpcsFile->fixer->beginChangeset(); foreach ($tokensToIndent as $searchToken => $indent) { $indentString = str_repeat(' ', $indent); - $isOpenTag = $tokens[$searchToken]['type'] === 'T_DOC_COMMENT_OPEN_TAG'; + $isOpenTag = $tokens[$searchToken]['code'] === T_DOC_COMMENT_OPEN_TAG; if ($isOpenTag && $commentIndentation === 0) { $phpcsFile->fixer->addContentBefore($searchToken, $indentString); } else { diff --git a/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/Commenting/FunctionCommentSniff.php b/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/Commenting/FunctionCommentSniff.php index 7b7de4a1..cc59dd3e 100644 --- a/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/Commenting/FunctionCommentSniff.php +++ b/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/Commenting/FunctionCommentSniff.php @@ -15,8 +15,9 @@ namespace CakePHP\Sniffs\Commenting; use PHP_CodeSniffer\Files\File; -use PHP_CodeSniffer\Standards\PEAR\Sniffs\Commenting\FunctionCommentSniff as PearFunctionCommentSniff; +use PHP_CodeSniffer\Sniffs\Sniff; use PHP_CodeSniffer\Util\Common; +use PHP_CodeSniffer\Util\Tokens; /** * Parses and verifies the doc comments for functions. @@ -47,8 +48,139 @@ * @version Release: @package_version@ * @link http://pear.php.net/package/PHP_CodeSniffer */ -class FunctionCommentSniff extends PearFunctionCommentSniff +class FunctionCommentSniff implements Sniff { + /** + * Disable the check for functions with a lower visibility than the value given. + * + * Allowed values are public, protected, and private. + * + * @var string + */ + public $minimumVisibility = 'private'; + + /** + * Array of methods which do not require a return type. + * + * @var array + */ + public $specialMethods = [ + '__construct', + '__destruct', + ]; + + /** + * Returns an array of tokens this test wants to listen for. + * + * @return array + */ + public function register() + { + return [T_FUNCTION]; + } + + /** + * Processes this test, when one of its tokens is encountered. + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. + * @param int $stackPtr The position of the current token in the stack passed in $tokens. + * @return void + */ + public function process(File $phpcsFile, $stackPtr) + { + $scopeModifier = $phpcsFile->getMethodProperties($stackPtr)['scope']; + if ( + $scopeModifier === 'protected' + && $this->minimumVisibility === 'public' + || $scopeModifier === 'private' + && ($this->minimumVisibility === 'public' || $this->minimumVisibility === 'protected') + ) { + return; + } + + $tokens = $phpcsFile->getTokens(); + $ignore = Tokens::$methodPrefixes; + $ignore[] = T_WHITESPACE; + + $commentEnd = $phpcsFile->findPrevious($ignore, $stackPtr - 1, null, true); + if ($tokens[$commentEnd]['code'] === T_COMMENT) { + // Inline comments might just be closing comments for + // control structures or functions instead of function comments + // using the wrong comment type. If there is other code on the line, + // assume they relate to that code. + $prev = $phpcsFile->findPrevious($ignore, $commentEnd - 1, null, true); + if ($prev !== false && $tokens[$prev]['line'] === $tokens[$commentEnd]['line']) { + $commentEnd = $prev; + } + } + + if ( + $tokens[$commentEnd]['code'] !== T_DOC_COMMENT_CLOSE_TAG + && $tokens[$commentEnd]['code'] !== T_COMMENT + ) { + $previous = $commentEnd; + if ( + $tokens[$commentEnd]['code'] === T_ATTRIBUTE_END + || $tokens[$commentEnd]['code'] === T_ATTRIBUTE + ) { + while ($tokens[$previous]['code'] !== T_ATTRIBUTE) { + $previous--; + } + $previous--; + + $commentEnd = $phpcsFile->findPrevious($ignore, $previous, null, true); + if ($tokens[$commentEnd]['code'] === T_DOC_COMMENT_CLOSE_TAG) { + if ($tokens[$commentEnd]['line'] !== $tokens[$previous]['line'] - 1) { + $error = 'There must be no blank lines after the function comment'; + $phpcsFile->addError($error, $commentEnd, 'SpacingAfter'); + } + + return; + } + } + + $function = $phpcsFile->getDeclarationName($stackPtr); + $phpcsFile->addError( + 'Missing doc comment for function %s()', + $stackPtr, + 'Missing', + [$function] + ); + $phpcsFile->recordMetric($stackPtr, 'Function has doc comment', 'no'); + + return; + } else { + $phpcsFile->recordMetric($stackPtr, 'Function has doc comment', 'yes'); + } + + if ($tokens[$commentEnd]['code'] === T_COMMENT) { + $phpcsFile->addError('You must use "/**" style comments for a function comment', $stackPtr, 'WrongStyle'); + + return; + } + + if ($tokens[$commentEnd]['line'] !== $tokens[$stackPtr]['line'] - 1) { + $error = 'There must be no blank lines after the function comment'; + $phpcsFile->addError($error, $commentEnd, 'SpacingAfter'); + } + + $commentStart = $tokens[$commentEnd]['comment_opener']; + foreach ($tokens[$commentStart]['comment_tags'] as $tag) { + if ($tokens[$tag]['content'] === '@see') { + // Make sure the tag isn't empty. + $string = $phpcsFile->findNext(T_DOC_COMMENT_STRING, $tag, $commentEnd); + if ($string === false || $tokens[$string]['line'] !== $tokens[$tag]['line']) { + $error = 'Content missing for @see tag in function comment'; + $phpcsFile->addError($error, $tag, 'EmptySees'); + } + } + } + + $this->processReturn($phpcsFile, $stackPtr, $commentStart); + $this->processThrows($phpcsFile, $stackPtr, $commentStart); + $this->processParams($phpcsFile, $stackPtr, $commentStart); + } + /** * Checks if the doc comment is an inheritDoc comment. * diff --git a/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/Formatting/BlankLineBeforeReturnSniff.php b/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/Formatting/BlankLineBeforeReturnSniff.php index 7c998055..1eb9faed 100644 --- a/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/Formatting/BlankLineBeforeReturnSniff.php +++ b/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/Formatting/BlankLineBeforeReturnSniff.php @@ -58,24 +58,24 @@ public function process(File $phpcsFile, $stackPtr) while ($current >= 0 && $tokens[$current]['line'] >= $previousLine) { if ( $tokens[$current]['line'] == $previousLine - && $tokens[$current]['type'] !== 'T_WHITESPACE' - && $tokens[$current]['type'] !== 'T_COMMENT' - && $tokens[$current]['type'] !== 'T_DOC_COMMENT_OPEN_TAG' - && $tokens[$current]['type'] !== 'T_DOC_COMMENT_TAG' - && $tokens[$current]['type'] !== 'T_DOC_COMMENT_STRING' - && $tokens[$current]['type'] !== 'T_DOC_COMMENT_CLOSE_TAG' - && $tokens[$current]['type'] !== 'T_DOC_COMMENT_WHITESPACE' + && $tokens[$current]['code'] !== T_WHITESPACE + && $tokens[$current]['code'] !== T_COMMENT + && $tokens[$current]['code'] !== T_DOC_COMMENT_OPEN_TAG + && $tokens[$current]['code'] !== T_DOC_COMMENT_TAG + && $tokens[$current]['code'] !== T_DOC_COMMENT_STRING + && $tokens[$current]['code'] !== T_DOC_COMMENT_CLOSE_TAG + && $tokens[$current]['code'] !== T_DOC_COMMENT_WHITESPACE ) { - $prevLineTokens[] = $tokens[$current]['type']; + $prevLineTokens[] = $tokens[$current]['code']; } $current--; } if ( isset($prevLineTokens[0]) - && ($prevLineTokens[0] === 'T_OPEN_CURLY_BRACKET' - || $prevLineTokens[0] === 'T_COLON' - || $prevLineTokens[0] === 'T_OPEN_TAG') + && ($prevLineTokens[0] === T_OPEN_CURLY_BRACKET + || $prevLineTokens[0] === T_COLON + || $prevLineTokens[0] === T_OPEN_TAG) ) { return; } elseif (count($prevLineTokens) > 0) { diff --git a/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/NamingConventions/ValidFunctionNameSniff.php b/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/NamingConventions/ValidFunctionNameSniff.php index 12b886ac..7212f25d 100644 --- a/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/NamingConventions/ValidFunctionNameSniff.php +++ b/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/NamingConventions/ValidFunctionNameSniff.php @@ -41,6 +41,8 @@ class ValidFunctionNameSniff extends AbstractScopeSniff 'unset', 'sleep', 'wakeup', + 'serialize', + 'unserialize', 'toString', 'set_state', 'clone', diff --git a/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/WhiteSpace/FunctionSpacingSniff.php b/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/WhiteSpace/FunctionSpacingSniff.php index 069b3659..f5b50085 100644 --- a/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/WhiteSpace/FunctionSpacingSniff.php +++ b/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/WhiteSpace/FunctionSpacingSniff.php @@ -57,7 +57,7 @@ public function process(File $phpCsFile, $stackPointer) $nextContentIndex = $phpCsFile->findNext(T_WHITESPACE, $semicolonIndex + 1, null, true); // Do not mess with the end of the class - if ($tokens[$nextContentIndex]['type'] === 'T_CLOSE_CURLY_BRACKET') { + if ($tokens[$nextContentIndex]['code'] === T_CLOSE_CURLY_BRACKET) { return; } @@ -86,7 +86,7 @@ public function process(File $phpCsFile, $stackPointer) $nextContentIndex = $phpCsFile->findNext(T_WHITESPACE, $closingBraceIndex + 1, null, true); // Do not mess with the end of the class - if ($tokens[$nextContentIndex]['type'] === 'T_CLOSE_CURLY_BRACKET') { + if ($tokens[$nextContentIndex]['code'] === T_CLOSE_CURLY_BRACKET) { return; } @@ -134,7 +134,12 @@ protected function assertNewLineAtTheBeginning(File $phpCsFile, $stackPointer) } $prevContentIndex = $phpCsFile->findPrevious(T_WHITESPACE, $firstTokenInLineIndex - 1, null, true); - if ($tokens[$prevContentIndex]['type'] === 'T_DOC_COMMENT_CLOSE_TAG') { + + if ($tokens[$prevContentIndex]['code'] === T_ATTRIBUTE_END) { + return; + } + + if ($tokens[$prevContentIndex]['code'] === T_DOC_COMMENT_CLOSE_TAG) { $firstTokenInLineIndex = $tokens[$prevContentIndex]['comment_opener']; while ($tokens[$firstTokenInLineIndex - 1]['line'] === $line) { $firstTokenInLineIndex--; @@ -144,7 +149,7 @@ protected function assertNewLineAtTheBeginning(File $phpCsFile, $stackPointer) $prevContentIndex = $phpCsFile->findPrevious(T_WHITESPACE, $firstTokenInLineIndex - 1, null, true); // Do not mess with the start of the class - if ($tokens[$prevContentIndex]['type'] === 'T_OPEN_CURLY_BRACKET') { + if ($tokens[$prevContentIndex]['code'] === T_OPEN_CURLY_BRACKET) { return; } diff --git a/app/vendor/cakephp/cakephp-codesniffer/CakePHP/ruleset.xml b/app/vendor/cakephp/cakephp-codesniffer/CakePHP/ruleset.xml index c205a127..b85444eb 100644 --- a/app/vendor/cakephp/cakephp-codesniffer/CakePHP/ruleset.xml +++ b/app/vendor/cakephp/cakephp-codesniffer/CakePHP/ruleset.xml @@ -8,127 +8,89 @@ /*/tmp/ tests/*/templates/* - - - - - 0 - - - 0 + + + + + + + - - - 0 + + + */config/Migrations/* - - 0 + + */config/* + */tests/* - - 0 + + */src/Controller/* + */src/Command/* + */src/Shell/* + */tests/* - - - 0 - - - 0 - - - 0 - - - 0 - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - + - + - - + + + + + */tests/* + - - - - + + + + */tests/* + + + + + + */config/Migrations/* + + + + + + + + + + + + - - - - - - - - - - - */tests/* - - + + - + - */tests/* - - - - - */config/* - */tests/* - - - */src/Controller/* - */src/Command/* - */src/Shell/* - */tests/* + @@ -141,7 +103,11 @@ - + + + + + @@ -157,12 +123,8 @@ - - - 0 - - - 0 + + @@ -188,8 +150,11 @@ - + + + + */config/* @@ -202,5 +167,15 @@ + + + + + + + + + + diff --git a/app/vendor/cakephp/cakephp-codesniffer/README.md b/app/vendor/cakephp/cakephp-codesniffer/README.md index 533515fa..1d7e3943 100644 --- a/app/vendor/cakephp/cakephp-codesniffer/README.md +++ b/app/vendor/cakephp/cakephp-codesniffer/README.md @@ -1,6 +1,6 @@ # CakePHP Code Sniffer -[![Build Status](https://img.shields.io/travis/com/cakephp/cakephp-codesniffer/master.svg?style=flat-square)](https://travis-ci.com/cakephp/cakephp-codesniffer) +![Build Status](https://github.com/cakephp/cakephp-codesniffer/actions/workflows/ci.yml/badge.svg?branch=master) [![Total Downloads](https://img.shields.io/packagist/dt/cakephp/cakephp-codesniffer.svg?style=flat-square)](https://packagist.org/packages/cakephp/cakephp-codesniffer) [![Latest Stable Version](https://img.shields.io/packagist/v/cakephp/cakephp-codesniffer.svg?style=flat-square)](https://packagist.org/packages/cakephp/cakephp-codesniffer) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) diff --git a/app/vendor/cakephp/cakephp-codesniffer/composer.json b/app/vendor/cakephp/cakephp-codesniffer/composer.json index 3ceb62a7..2fd121be 100644 --- a/app/vendor/cakephp/cakephp-codesniffer/composer.json +++ b/app/vendor/cakephp/cakephp-codesniffer/composer.json @@ -19,8 +19,8 @@ }, "require": { "php": ">=7.2.0", - "slevomat/coding-standard": "^6.3.6", - "squizlabs/php_codesniffer": "~3.5.5" + "slevomat/coding-standard": "^6.3.6 || ^7.0", + "squizlabs/php_codesniffer": "^3.6" }, "require-dev": { "phpunit/phpunit": "^7.1" diff --git a/app/vendor/cakephp/cakephp-codesniffer/docs/README.md b/app/vendor/cakephp/cakephp-codesniffer/docs/README.md index 46929d92..e5727fe3 100644 --- a/app/vendor/cakephp/cakephp-codesniffer/docs/README.md +++ b/app/vendor/cakephp/cakephp-codesniffer/docs/README.md @@ -1,6 +1,6 @@ # CakePHP ruleset -The CakePHP standard contains 140 sniffs +The CakePHP standard contains 136 sniffs CakePHP (19 sniffs) ------------------- @@ -82,11 +82,10 @@ PSR12 (16 sniffs) - PSR12.Properties.ConstantVisibility - PSR12.Traits.UseDeclaration -PSR2 (12 sniffs) ----------------- +PSR2 (9 sniffs) +--------------- - PSR2.Classes.ClassDeclaration - PSR2.Classes.PropertyDeclaration -- PSR2.ControlStructures.ControlStructureSpacing - PSR2.ControlStructures.ElseIfDeclaration - PSR2.ControlStructures.SwitchDeclaration - PSR2.Files.ClosingTag @@ -94,8 +93,6 @@ PSR2 (12 sniffs) - PSR2.Methods.FunctionCallSignature - PSR2.Methods.FunctionClosingBrace - PSR2.Methods.MethodDeclaration -- PSR2.Namespaces.NamespaceDeclaration -- PSR2.Namespaces.UseDeclaration SlevomatCodingStandard (32 sniffs) ---------------------------------- @@ -166,4 +163,4 @@ Squiz (29 sniffs) Zend (1 sniff) --------------- -- Zend.NamingConventions.ValidVariableName +- Zend.NamingConventions.ValidVariableName \ No newline at end of file diff --git a/app/vendor/cakephp/cakephp/README.md b/app/vendor/cakephp/cakephp/README.md index 3ff7f33b..9cb846bb 100644 --- a/app/vendor/cakephp/cakephp/README.md +++ b/app/vendor/cakephp/cakephp/README.md @@ -7,8 +7,10 @@ Software License - Build Status - + + Build Status + + Coverage Status @@ -68,6 +70,7 @@ tests for CakePHP by doing the following: ## Get Support! * [Slack](https://cakesf.herokuapp.com/) - Join us on Slack. +* [Discord](https://discord.gg/k4trEMPebj) - Join us on Discord. * [#cakephp](https://webchat.freenode.net/?channels=#cakephp) on irc.freenode.net - Come chat with us, we have cake. * [Forum](https://discourse.cakephp.org/) - Official CakePHP forum. * [GitHub Issues](https://github.com/cakephp/cakephp/issues) - Got issues? Please tell us! @@ -80,12 +83,5 @@ tests for CakePHP by doing the following: # Security -If you’ve found a security issue in CakePHP, please use the following procedure instead of the normal bug reporting system. Instead of using the bug tracker, mailing list or IRC please send an email to security [at] cakephp.org. Emails sent to this address go to the CakePHP core team on a private mailing list. - -For each report, we try to first confirm the vulnerability. Once confirmed, the CakePHP team will take the following actions: - -- Acknowledge to the reporter that we’ve received the issue, and are working on a fix. We ask that the reporter keep the issue confidential until we announce it. -- Get a fix/patch prepared. -- Prepare a post describing the vulnerability, and the possible exploits. -- Release new versions of all affected versions. -- Prominently feature the problem in the release announcement. +If you’ve found a security issue in CakePHP, please use the procedure +described in [SECURITY.md](.github/SECURITY.md). diff --git a/app/vendor/cakephp/cakephp/SECURITY.md b/app/vendor/cakephp/cakephp/SECURITY.md deleted file mode 100644 index fed257e9..00000000 --- a/app/vendor/cakephp/cakephp/SECURITY.md +++ /dev/null @@ -1,31 +0,0 @@ -# Security Policy - -## Supported Versions - -We support fixing security issues on the following releases: - -| Version | Supported | -| ------- | ------------------ | -| 4.0.x | :white_check_mark: | -| 3.8.x | :white_check_mark: | -| 3.7.x | :white_check_mark: | -| <= 3.6 | :x: | -| 2.10.x | :white_check_mark: | -| <= 2.9 | :x: | - -## Reporting a Vulnerability - -If you’ve found a security issue in CakePHP, please use the following procedure -instead of the normal bug reporting system. Instead of using the bug tracker, -mailing list or IRC please send an email to security [at] cakephp.org. Emails -sent to this address go to the CakePHP core team on a private mailing list. - -For each report, we try to first confirm the vulnerability. Once confirmed, -the CakePHP team will take the following actions: - -* Acknowledge to the reporter that we’ve received the issue, and are - working on a fix. We ask that the reporter keep the issue confidential until we announce it. -* Get a fix/patch prepared. -* Prepare a post describing the vulnerability, and the possible exploits. -* Release new versions of all affected versions. -* Prominently feature the problem in the release announcement diff --git a/app/vendor/cakephp/cakephp/VERSION.txt b/app/vendor/cakephp/cakephp/VERSION.txt index 8b1a2d88..43155def 100644 --- a/app/vendor/cakephp/cakephp/VERSION.txt +++ b/app/vendor/cakephp/cakephp/VERSION.txt @@ -16,4 +16,4 @@ // @license https://opensource.org/licenses/mit-license.php MIT License // +--------------------------------------------------------------------------------------------+ // //////////////////////////////////////////////////////////////////////////////////////////////////// -4.2.9 +4.3.9 diff --git a/app/vendor/cakephp/cakephp/composer.json b/app/vendor/cakephp/cakephp/composer.json index 2575cda2..ba3abe71 100644 --- a/app/vendor/cakephp/cakephp/composer.json +++ b/app/vendor/cakephp/cakephp/composer.json @@ -26,16 +26,17 @@ "ext-intl": "*", "ext-json": "*", "ext-mbstring": "*", - "cakephp/chronos": "^2.0", + "cakephp/chronos": "^2.2", "composer/ca-bundle": "^1.2", "laminas/laminas-diactoros": "^2.2.2", "laminas/laminas-httphandlerrunner": "^1.1", - "league/container": "^3.2", + "league/container": "^4.2.0", + "psr/container": "^1.1 || ^2.0", "psr/http-client": "^1.0", "psr/http-server-handler": "^1.0", "psr/http-server-middleware": "^1.0", - "psr/log": "^1.0.0", - "psr/simple-cache": "^1.0.0" + "psr/log": "^1.0 || ^2.0", + "psr/simple-cache": "^1.0 || ^2.0" }, "replace": { "cakephp/cache": "self.version", @@ -55,8 +56,8 @@ "cakephp/validation": "self.version" }, "require-dev": { - "cakephp/cakephp-codesniffer": "^4.0", - "mikey179/vfsstream": "^1.6", + "cakephp/cakephp-codesniffer": "^4.5", + "mikey179/vfsstream": "^1.6.10", "paragonie/csp-builder": "^2.3", "phpunit/phpunit": "^8.5 || ^9.3" }, @@ -68,7 +69,10 @@ }, "config": { "process-timeout": 900, - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } }, "autoload": { "psr-4": { @@ -87,6 +91,7 @@ "Cake\\PHPStan\\": "tests/PHPStan/", "Cake\\Test\\": "tests/", "TestApp\\": "tests/test_app/TestApp/", + "TestApp\\Test\\": "tests/test_app/TestApp/tests/", "TestPlugin\\": "tests/test_app/Plugin/TestPlugin/src/", "TestPlugin\\Test\\": "tests/test_app/Plugin/TestPlugin/tests/", "TestPluginTwo\\": "tests/test_app/Plugin/TestPluginTwo/src/", @@ -108,7 +113,11 @@ "@phpstan", "@psalm" ], - "stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:0.12.94 psalm/phar:~4.9.3 && mv composer.backup composer.json", + "stan-tests": "phpstan.phar analyze -c tests/phpstan.neon", + "stan-baseline": "phpstan.phar --generate-baseline", + "stan-setup": "cp composer.json composer.backup && composer require --dev symfony/polyfill-php81 phpstan/phpstan:~1.6.0 psalm/phar:~4.22.0 && mv composer.backup composer.json", + "lowest": "validate-prefer-lowest", + "lowest-setup": "composer update --prefer-lowest --prefer-stable --prefer-dist --no-interaction && cp composer.json composer.backup && composer require --dev dereuromark/composer-prefer-lowest && mv composer.backup composer.json", "test": "phpunit", "test-coverage": "phpunit --coverage-clover=clover.xml" }, diff --git a/app/vendor/cakephp/cakephp/src/Auth/AbstractPasswordHasher.php b/app/vendor/cakephp/cakephp/src/Auth/AbstractPasswordHasher.php index 9b55f797..c9f3b408 100644 --- a/app/vendor/cakephp/cakephp/src/Auth/AbstractPasswordHasher.php +++ b/app/vendor/cakephp/cakephp/src/Auth/AbstractPasswordHasher.php @@ -30,14 +30,14 @@ abstract class AbstractPasswordHasher * * These are merged with user-provided config when the object is used. * - * @var array + * @var array */ protected $_defaultConfig = []; /** * Constructor * - * @param array $config Array of config. + * @param array $config Array of config. */ public function __construct(array $config = []) { diff --git a/app/vendor/cakephp/cakephp/src/Auth/BaseAuthenticate.php b/app/vendor/cakephp/cakephp/src/Auth/BaseAuthenticate.php index eccd1862..61dc2b14 100644 --- a/app/vendor/cakephp/cakephp/src/Auth/BaseAuthenticate.php +++ b/app/vendor/cakephp/cakephp/src/Auth/BaseAuthenticate.php @@ -44,7 +44,7 @@ abstract class BaseAuthenticate implements EventListenerInterface * or an array containing `className` key, any other keys will be passed as * config to the class. Defaults to 'Default'. * - * @var array + * @var array */ protected $_defaultConfig = [ 'fields' => [ @@ -71,7 +71,7 @@ abstract class BaseAuthenticate implements EventListenerInterface protected $_passwordHasher; /** - * Whether or not the user authenticated by this class + * Whether the user authenticated by this class * requires their password to be rehashed with another algorithm. * * @var bool @@ -82,7 +82,7 @@ abstract class BaseAuthenticate implements EventListenerInterface * Constructor * * @param \Cake\Controller\ComponentRegistry $registry The Component registry used on this request. - * @param array $config Array of config to use. + * @param array $config Array of config to use. */ public function __construct(ComponentRegistry $registry, array $config = []) { @@ -99,7 +99,7 @@ public function __construct(ComponentRegistry $registry, array $config = []) * @param string $username The username/identifier. * @param string|null $password The password, if not provided password checking is skipped * and result of find is returned. - * @return array|false Either false on failure, or an array of user data. + * @return array|false Either false on failure, or an array of user data. */ protected function _findUser(string $username, ?string $password = null) { @@ -171,9 +171,7 @@ protected function _query(string $username): Query $finder = key($finder); } - if (!isset($options['username'])) { - $options['username'] = $username; - } + $options['username'] = $options['username'] ?? $username; return $table->find($finder, $options); } @@ -197,7 +195,7 @@ public function passwordHasher(): AbstractPasswordHasher } /** - * Returns whether or not the password stored in the repository for the logged in user + * Returns whether the password stored in the repository for the logged in user * requires to be rehashed with another algorithm * * @return bool @@ -212,7 +210,7 @@ public function needsPasswordRehash(): bool * * @param \Cake\Http\ServerRequest $request Request to get authentication information from. * @param \Cake\Http\Response $response A response object that can have headers added. - * @return array|false Either false on failure, or an array of user data on success. + * @return array|false Either false on failure, or an array of user data on success. */ abstract public function authenticate(ServerRequest $request, Response $response); @@ -221,7 +219,7 @@ abstract public function authenticate(ServerRequest $request, Response $response * systems like basic and digest auth. * * @param \Cake\Http\ServerRequest $request Request object. - * @return array|false Either false or an array of user information + * @return array|false Either false or an array of user information */ public function getUser(ServerRequest $request) { @@ -233,7 +231,7 @@ public function getUser(ServerRequest $request) * can be: * * - Null - No action taken, AuthComponent should return appropriate response. - * - Cake\Http\Response - A response object, which will cause AuthComponent to + * - \Cake\Http\Response - A response object, which will cause AuthComponent to * simply return that response. * * @param \Cake\Http\ServerRequest $request A request object. @@ -258,7 +256,7 @@ public function unauthenticated(ServerRequest $request, Response $response) * function should have signature like `logout(EventInterface $event, array $user)` * where `$user` is the user about to be logged out. * - * @return array List of events this class listens to. Defaults to `[]`. + * @return array List of events this class listens to. Defaults to `[]`. */ public function implementedEvents(): array { diff --git a/app/vendor/cakephp/cakephp/src/Auth/BaseAuthorize.php b/app/vendor/cakephp/cakephp/src/Auth/BaseAuthorize.php index 2b2b2b7c..49c50ce7 100644 --- a/app/vendor/cakephp/cakephp/src/Auth/BaseAuthorize.php +++ b/app/vendor/cakephp/cakephp/src/Auth/BaseAuthorize.php @@ -39,7 +39,7 @@ abstract class BaseAuthorize /** * Default config for authorize objects. * - * @var array + * @var array */ protected $_defaultConfig = []; @@ -47,7 +47,7 @@ abstract class BaseAuthorize * Constructor * * @param \Cake\Controller\ComponentRegistry $registry The controller for this request. - * @param array $config An array of config. This class does not use any config. + * @param array $config An array of config. This class does not use any config. */ public function __construct(ComponentRegistry $registry, array $config = []) { @@ -58,7 +58,7 @@ public function __construct(ComponentRegistry $registry, array $config = []) /** * Checks user authorization. * - * @param array|\ArrayAccess $user Active user data + * @param \ArrayAccess|array $user Active user data * @param \Cake\Http\ServerRequest $request Request instance. * @return bool */ diff --git a/app/vendor/cakephp/cakephp/src/Auth/BasicAuthenticate.php b/app/vendor/cakephp/cakephp/src/Auth/BasicAuthenticate.php index a09d438a..4e55bf1c 100644 --- a/app/vendor/cakephp/cakephp/src/Auth/BasicAuthenticate.php +++ b/app/vendor/cakephp/cakephp/src/Auth/BasicAuthenticate.php @@ -59,7 +59,7 @@ class BasicAuthenticate extends BaseAuthenticate * * @param \Cake\Http\ServerRequest $request The request to authenticate with. * @param \Cake\Http\Response $response The response to add headers to. - * @return array|false Either false on failure, or an array of user data on success. + * @return array|false Either false on failure, or an array of user data on success. */ public function authenticate(ServerRequest $request, Response $response) { @@ -70,7 +70,7 @@ public function authenticate(ServerRequest $request, Response $response) * Get a user based on information in the request. Used by cookie-less auth for stateless clients. * * @param \Cake\Http\ServerRequest $request Request object. - * @return array|false Either false or an array of user information + * @return array|false Either false or an array of user information */ public function getUser(ServerRequest $request) { @@ -104,7 +104,7 @@ public function unauthenticated(ServerRequest $request, Response $response) * Generate the login headers * * @param \Cake\Http\ServerRequest $request Request object. - * @return string[] Headers for logging in. + * @return array Headers for logging in. */ public function loginHeaders(ServerRequest $request): array { diff --git a/app/vendor/cakephp/cakephp/src/Auth/ControllerAuthorize.php b/app/vendor/cakephp/cakephp/src/Auth/ControllerAuthorize.php index 58355ba7..8cd8b871 100644 --- a/app/vendor/cakephp/cakephp/src/Auth/ControllerAuthorize.php +++ b/app/vendor/cakephp/cakephp/src/Auth/ControllerAuthorize.php @@ -24,7 +24,7 @@ /** * An authorization adapter for AuthComponent. Provides the ability to authorize * using a controller callback. Your controller's isAuthorized() method should - * return a boolean to indicate whether or not the user is authorized. + * return a boolean to indicate whether the user is authorized. * * ``` * public function isAuthorized($user) @@ -78,7 +78,7 @@ public function controller(?Controller $controller = null): Controller /** * Checks user authorization using a controller callback. * - * @param array|\ArrayAccess $user Active user data + * @param \ArrayAccess|array $user Active user data * @param \Cake\Http\ServerRequest $request Request instance. * @throws \Cake\Core\Exception\CakeException If controller does not have method `isAuthorized()`. * @return bool diff --git a/app/vendor/cakephp/cakephp/src/Auth/DefaultPasswordHasher.php b/app/vendor/cakephp/cakephp/src/Auth/DefaultPasswordHasher.php index f0a3b419..35a8246c 100644 --- a/app/vendor/cakephp/cakephp/src/Auth/DefaultPasswordHasher.php +++ b/app/vendor/cakephp/cakephp/src/Auth/DefaultPasswordHasher.php @@ -31,7 +31,7 @@ class DefaultPasswordHasher extends AbstractPasswordHasher * - `hashOptions` - Associative array of options. Check the PHP manual for * supported options for each hash type. Defaults to empty array. * - * @var array + * @var array */ protected $_defaultConfig = [ 'hashType' => PASSWORD_DEFAULT, diff --git a/app/vendor/cakephp/cakephp/src/Auth/DigestAuthenticate.php b/app/vendor/cakephp/cakephp/src/Auth/DigestAuthenticate.php index b5ecda93..65921063 100644 --- a/app/vendor/cakephp/cakephp/src/Auth/DigestAuthenticate.php +++ b/app/vendor/cakephp/cakephp/src/Auth/DigestAuthenticate.php @@ -82,7 +82,7 @@ class DigestAuthenticate extends BasicAuthenticate * * @param \Cake\Controller\ComponentRegistry $registry The Component registry * used on this request. - * @param array $config Array of config to use. + * @param array $config Array of config to use. */ public function __construct(ComponentRegistry $registry, array $config = []) { @@ -101,7 +101,7 @@ public function __construct(ComponentRegistry $registry, array $config = []) * Get a user based on information in the request. Used by cookie-less auth for stateless clients. * * @param \Cake\Http\ServerRequest $request Request object. - * @return array|false Either false or an array of user information + * @return array|false Either false or an array of user information */ public function getUser(ServerRequest $request) { @@ -140,7 +140,7 @@ public function getUser(ServerRequest $request) * Gets the digest headers from the request/environment. * * @param \Cake\Http\ServerRequest $request Request object. - * @return array|null Array of digest information. + * @return array|null Array of digest information. */ protected function _getDigest(ServerRequest $request): ?array { @@ -188,7 +188,7 @@ public function parseAuthData(string $digest): ?array /** * Generate the response hash for a given digest array. * - * @param array $digest Digest information containing data from DigestAuthenticate::parseAuthData(). + * @param array $digest Digest information containing data from DigestAuthenticate::parseAuthData(). * @param string $password The digest hash password generated with DigestAuthenticate::password() * @param string $method Request method * @return string Response hash @@ -219,7 +219,7 @@ public static function password(string $username, string $password, string $real * Generate the login headers * * @param \Cake\Http\ServerRequest $request Request object. - * @return string[] Headers for logging in. + * @return array Headers for logging in. */ public function loginHeaders(ServerRequest $request): array { diff --git a/app/vendor/cakephp/cakephp/src/Auth/FallbackPasswordHasher.php b/app/vendor/cakephp/cakephp/src/Auth/FallbackPasswordHasher.php index b45d8d81..7c4de051 100644 --- a/app/vendor/cakephp/cakephp/src/Auth/FallbackPasswordHasher.php +++ b/app/vendor/cakephp/cakephp/src/Auth/FallbackPasswordHasher.php @@ -26,7 +26,7 @@ class FallbackPasswordHasher extends AbstractPasswordHasher /** * Default config for this object. * - * @var array + * @var array */ protected $_defaultConfig = [ 'hashers' => [], @@ -35,14 +35,14 @@ class FallbackPasswordHasher extends AbstractPasswordHasher /** * Holds the list of password hasher objects that will be used * - * @var \Cake\Auth\AbstractPasswordHasher[] + * @var array<\Cake\Auth\AbstractPasswordHasher> */ protected $_hashers = []; /** * Constructor * - * @param array $config configuration options for this object. Requires the + * @param array $config configuration options for this object. Requires the * `hashers` key to be present in the array with a list of other hashers to be * used. */ diff --git a/app/vendor/cakephp/cakephp/src/Auth/FormAuthenticate.php b/app/vendor/cakephp/cakephp/src/Auth/FormAuthenticate.php index 41e59315..953bbcaa 100644 --- a/app/vendor/cakephp/cakephp/src/Auth/FormAuthenticate.php +++ b/app/vendor/cakephp/cakephp/src/Auth/FormAuthenticate.php @@ -51,7 +51,7 @@ class FormAuthenticate extends BaseAuthenticate * Checks the fields to ensure they are supplied. * * @param \Cake\Http\ServerRequest $request The request that contains login information. - * @param array $fields The fields to be checked. + * @param array $fields The fields to be checked. * @return bool False if the fields have not been supplied. True if they exist. */ protected function _checkFields(ServerRequest $request, array $fields): bool @@ -73,7 +73,7 @@ protected function _checkFields(ServerRequest $request, array $fields): bool * * @param \Cake\Http\ServerRequest $request The request that contains login information. * @param \Cake\Http\Response $response Unused response object. - * @return array|false False on login failure. An array of User data on success. + * @return array|false False on login failure. An array of User data on success. */ public function authenticate(ServerRequest $request, Response $response) { diff --git a/app/vendor/cakephp/cakephp/src/Auth/PasswordHasherFactory.php b/app/vendor/cakephp/cakephp/src/Auth/PasswordHasherFactory.php index 52a82919..06bebc0e 100644 --- a/app/vendor/cakephp/cakephp/src/Auth/PasswordHasherFactory.php +++ b/app/vendor/cakephp/cakephp/src/Auth/PasswordHasherFactory.php @@ -27,11 +27,11 @@ class PasswordHasherFactory /** * Returns password hasher object out of a hasher name or a configuration array * - * @param string|array $passwordHasher Name of the password hasher or an array with + * @param array|string $passwordHasher Name of the password hasher or an array with * at least the key `className` set to the name of the class to use * @return \Cake\Auth\AbstractPasswordHasher Password hasher instance * @throws \RuntimeException If password hasher class not found or - * it does not extend Cake\Auth\AbstractPasswordHasher + * it does not extend {@link \Cake\Auth\AbstractPasswordHasher} */ public static function build($passwordHasher): AbstractPasswordHasher { diff --git a/app/vendor/cakephp/cakephp/src/Auth/Storage/MemoryStorage.php b/app/vendor/cakephp/cakephp/src/Auth/Storage/MemoryStorage.php index 6c0a6f9c..0be0d144 100644 --- a/app/vendor/cakephp/cakephp/src/Auth/Storage/MemoryStorage.php +++ b/app/vendor/cakephp/cakephp/src/Auth/Storage/MemoryStorage.php @@ -31,7 +31,7 @@ class MemoryStorage implements StorageInterface /** * Redirect URL. * - * @var string|array|null + * @var array|string|null */ protected $_redirectUrl; @@ -75,5 +75,7 @@ public function redirectUrl($url = null) } $this->_redirectUrl = $url; + + return null; } } diff --git a/app/vendor/cakephp/cakephp/src/Auth/Storage/SessionStorage.php b/app/vendor/cakephp/cakephp/src/Auth/Storage/SessionStorage.php index 07ff8b75..bfb6463f 100644 --- a/app/vendor/cakephp/cakephp/src/Auth/Storage/SessionStorage.php +++ b/app/vendor/cakephp/cakephp/src/Auth/Storage/SessionStorage.php @@ -52,7 +52,7 @@ class SessionStorage implements StorageInterface * - `key` - Session key used to store user record. * - `redirect` - Session key used to store redirect URL. * - * @var array + * @var array */ protected $_defaultConfig = [ 'key' => 'Auth.User', @@ -64,7 +64,7 @@ class SessionStorage implements StorageInterface * * @param \Cake\Http\ServerRequest $request Request instance. * @param \Cake\Http\Response $response Response instance. - * @param array $config Configuration list. + * @param array $config Configuration list. */ public function __construct(ServerRequest $request, Response $response, array $config = []) { @@ -96,7 +96,7 @@ public function read() * * The session id is also renewed to help mitigate issues with session replays. * - * @param array|\ArrayAccess $user User record. + * @param \ArrayAccess|array $user User record. * @return void */ public function write($user): void @@ -138,5 +138,7 @@ public function redirectUrl($url = null) } $this->_session->write($this->_config['redirect'], $url); + + return null; } } diff --git a/app/vendor/cakephp/cakephp/src/Auth/Storage/StorageInterface.php b/app/vendor/cakephp/cakephp/src/Auth/Storage/StorageInterface.php index 1da65c48..6e8aadd4 100644 --- a/app/vendor/cakephp/cakephp/src/Auth/Storage/StorageInterface.php +++ b/app/vendor/cakephp/cakephp/src/Auth/Storage/StorageInterface.php @@ -51,7 +51,7 @@ public function delete(): void; * * @param mixed $url Redirect URL. If `null` returns current URL. If `false` * deletes currently set URL. - * @return string|array|null + * @return array|string|null */ public function redirectUrl($url = null); } diff --git a/app/vendor/cakephp/cakephp/src/Auth/WeakPasswordHasher.php b/app/vendor/cakephp/cakephp/src/Auth/WeakPasswordHasher.php index 6ac275a3..5028b85c 100644 --- a/app/vendor/cakephp/cakephp/src/Auth/WeakPasswordHasher.php +++ b/app/vendor/cakephp/cakephp/src/Auth/WeakPasswordHasher.php @@ -30,7 +30,7 @@ class WeakPasswordHasher extends AbstractPasswordHasher /** * Default config for this object. * - * @var array + * @var array */ protected $_defaultConfig = [ 'hashType' => null, diff --git a/app/vendor/cakephp/cakephp/src/Cache/Cache.php b/app/vendor/cakephp/cakephp/src/Cache/Cache.php index fabf32a3..0c8d8d37 100644 --- a/app/vendor/cakephp/cakephp/src/Cache/Cache.php +++ b/app/vendor/cakephp/cakephp/src/Cache/Cache.php @@ -71,7 +71,7 @@ class Cache * An array mapping URL schemes to fully qualified caching engine * class names. * - * @var string[] + * @var array * @psalm-var array */ protected static $_dsnClassMap = [ @@ -85,7 +85,7 @@ class Cache ]; /** - * Flag for tracking whether or not caching is enabled. + * Flag for tracking whether caching is enabled. * * @var bool */ @@ -94,7 +94,7 @@ class Cache /** * Group to Config mapping * - * @var array + * @var array */ protected static $_groups = []; @@ -466,7 +466,7 @@ public static function clear(string $config = 'default'): bool /** * Delete all keys from the cache from all configurations. * - * @return bool[] Status code. For each configuration, it reports the status of the operation + * @return array Status code. For each configuration, it reports the status of the operation */ public static function clearAll(): array { @@ -503,8 +503,8 @@ public static function clearGroup(string $group, string $config = 'default'): bo * $configs will equal to `['posts' => ['daily', 'weekly']]` * Calling this method will load all the configured engines. * - * @param string|null $group group name or null to retrieve all group mappings - * @return array map of group and all configuration that has the same group + * @param string|null $group Group name or null to retrieve all group mappings + * @return array Map of group and all configuration that has the same group * @throws \Cake\Cache\InvalidArgumentException */ public static function groupConfigs(?string $group = null): array @@ -548,7 +548,7 @@ public static function disable(): void } /** - * Check whether or not caching is enabled. + * Check whether caching is enabled. * * @return bool */ @@ -579,9 +579,8 @@ public static function enabled(): bool * the cache key is empty. Can be any callable type supported by your PHP. * @param string $config The cache configuration to use for this operation. * Defaults to default. - * @return mixed If the key is found: the cached data, false if the data - * missing/expired, or an error. If the key is not found: boolean of the - * success of the write + * @return mixed If the key is found: the cached data. + * If the key is not found the value returned by the callable. */ public static function remember(string $key, callable $callable, string $config = 'default') { diff --git a/app/vendor/cakephp/cakephp/src/Cache/CacheEngine.php b/app/vendor/cakephp/cakephp/src/Cache/CacheEngine.php index 56db6953..ed01098e 100644 --- a/app/vendor/cakephp/cakephp/src/Cache/CacheEngine.php +++ b/app/vendor/cakephp/cakephp/src/Cache/CacheEngine.php @@ -49,7 +49,7 @@ abstract class CacheEngine implements CacheInterface, CacheEngineInterface * - `warnOnWriteFailures` Some engines, such as ApcuEngine, may raise warnings on * write failures. * - * @var array + * @var array */ protected $_defaultConfig = [ 'duration' => 3600, @@ -72,7 +72,7 @@ abstract class CacheEngine implements CacheInterface, CacheEngineInterface * Called automatically by the cache frontend. Merge the runtime config with the defaults * before use. * - * @param array $config Associative array of parameters for the engine + * @param array $config Associative array of parameters for the engine * @return bool True if the engine has been successfully initialized, false if not */ public function init(array $config = []): bool @@ -187,7 +187,11 @@ public function setMultiple($values, $ttl = null): bool } /** - * Deletes multiple cache items in a single operation. + * Deletes multiple cache items as a list + * + * This is a best effort attempt. If deleting an item would + * create an error it will be ignored, and all items will + * be attempted. * * @param iterable $keys A list of string-based keys to be deleted. * @return bool True if the items were successfully removed. False if there was an error. @@ -198,14 +202,14 @@ public function deleteMultiple($keys): bool { $this->ensureValidType($keys); + $result = true; foreach ($keys as $key) { - $result = $this->delete($key); - if ($result === false) { - return false; + if (!$this->delete($key)) { + $result = false; } } - return true; + return $result; } /** @@ -317,7 +321,7 @@ abstract public function clearGroup(string $group): bool; * and returns the `group value` for each of them, this is * the token representing each group in the cache key * - * @return string[] + * @return array */ public function groups(): array { diff --git a/app/vendor/cakephp/cakephp/src/Cache/CacheRegistry.php b/app/vendor/cakephp/cakephp/src/Cache/CacheRegistry.php index fb6d0ab0..1c5aa466 100644 --- a/app/vendor/cakephp/cakephp/src/Cache/CacheRegistry.php +++ b/app/vendor/cakephp/cakephp/src/Cache/CacheRegistry.php @@ -24,7 +24,7 @@ /** * An object registry for cache engines. * - * Used by Cake\Cache\Cache to load and manage cache engines. + * Used by {@link \Cake\Cache\Cache} to load and manage cache engines. * * @extends \Cake\Core\ObjectRegistry<\Cake\Cache\CacheEngine> */ @@ -64,9 +64,9 @@ protected function _throwMissingClassError(string $class, ?string $plugin): void * * Part of the template method for Cake\Core\ObjectRegistry::load() * - * @param string|\Cake\Cache\CacheEngine $class The classname or object to make. + * @param \Cake\Cache\CacheEngine|string $class The classname or object to make. * @param string $alias The alias of the object. - * @param array $config An array of settings to use for the cache engine. + * @param array $config An array of settings to use for the cache engine. * @return \Cake\Cache\CacheEngine The constructed CacheEngine class. * @throws \RuntimeException when an object doesn't implement the correct interface. */ diff --git a/app/vendor/cakephp/cakephp/src/Cache/Engine/ApcuEngine.php b/app/vendor/cakephp/cakephp/src/Cache/Engine/ApcuEngine.php index 170ea4a4..bc90e8f0 100644 --- a/app/vendor/cakephp/cakephp/src/Cache/Engine/ApcuEngine.php +++ b/app/vendor/cakephp/cakephp/src/Cache/Engine/ApcuEngine.php @@ -29,7 +29,7 @@ class ApcuEngine extends CacheEngine * Contains the compiled group names * (prefixed with the global configuration prefix) * - * @var string[] + * @var array */ protected $_compiledGroupNames = []; @@ -38,7 +38,7 @@ class ApcuEngine extends CacheEngine * * Called automatically by the cache frontend * - * @param array $config array of setting for the engine + * @param array $config array of setting for the engine * @return bool True if the engine has been successfully initialized, false if not */ public function init(array $config = []): bool @@ -183,7 +183,7 @@ public function add(string $key, $value): bool * If the group initial value was not found, then it initializes * the group accordingly. * - * @return string[] + * @return array * @link https://secure.php.net/manual/en/function.apcu-fetch.php * @link https://secure.php.net/manual/en/function.apcu-store.php */ diff --git a/app/vendor/cakephp/cakephp/src/Cache/Engine/ArrayEngine.php b/app/vendor/cakephp/cakephp/src/Cache/Engine/ArrayEngine.php index c3360820..9050537e 100644 --- a/app/vendor/cakephp/cakephp/src/Cache/Engine/ArrayEngine.php +++ b/app/vendor/cakephp/cakephp/src/Cache/Engine/ArrayEngine.php @@ -152,7 +152,7 @@ public function clear(): bool * If the group initial value was not found, then it initializes * the group accordingly. * - * @return string[] + * @return array */ public function groups(): array { diff --git a/app/vendor/cakephp/cakephp/src/Cache/Engine/FileEngine.php b/app/vendor/cakephp/cakephp/src/Cache/Engine/FileEngine.php index 22ec33ce..46a7f187 100644 --- a/app/vendor/cakephp/cakephp/src/Cache/Engine/FileEngine.php +++ b/app/vendor/cakephp/cakephp/src/Cache/Engine/FileEngine.php @@ -57,7 +57,7 @@ class FileEngine extends CacheEngine * cache::gc from ever being called automatically. * - `serialize` Should cache objects be serialized first. * - * @var array + * @var array */ protected $_defaultConfig = [ 'duration' => 3600, @@ -81,7 +81,7 @@ class FileEngine extends CacheEngine * * Called automatically by the cache frontend. * - * @param array $config array of setting for the engine + * @param array $config array of setting for the engine * @return bool True if the engine has been successfully initialized, false if not */ public function init(array $config = []): bool @@ -223,6 +223,10 @@ public function delete($key): bool $path = $this->_File->getRealPath(); $this->_File = null; + if ($path === false) { + return false; + } + // phpcs:disable return @unlink($path); // phpcs:enable diff --git a/app/vendor/cakephp/cakephp/src/Cache/Engine/MemcachedEngine.php b/app/vendor/cakephp/cakephp/src/Cache/Engine/MemcachedEngine.php index 781c4cfc..b714f505 100644 --- a/app/vendor/cakephp/cakephp/src/Cache/Engine/MemcachedEngine.php +++ b/app/vendor/cakephp/cakephp/src/Cache/Engine/MemcachedEngine.php @@ -60,7 +60,7 @@ class MemcachedEngine extends CacheEngine * - `options` - Additional options for the memcached client. Should be an array of option => value. * Use the \Memcached::OPT_* constants as keys. * - * @var array + * @var array */ protected $_defaultConfig = [ 'compress' => false, @@ -82,12 +82,12 @@ class MemcachedEngine extends CacheEngine * * Memcached must be compiled with JSON and igbinary support to use these engines * - * @var array + * @var array */ protected $_serializers = []; /** - * @var string[] + * @var array */ protected $_compiledGroupNames = []; @@ -96,7 +96,7 @@ class MemcachedEngine extends CacheEngine * * Called automatically by the cache frontend * - * @param array $config array of setting for the engine + * @param array $config array of setting for the engine * @return bool True if the engine has been successfully initialized, false if not * @throws \InvalidArgumentException When you try use authentication without * Memcached compiled with SASL support @@ -134,11 +134,6 @@ public function init(array $config = []): bool $this->_config['servers'] = [$this->_config['servers']]; } - /** @psalm-suppress RedundantPropertyInitializationCheck */ - if (isset($this->_Memcached)) { - return true; - } - if ($this->_config['persistent']) { $this->_Memcached = new Memcached($this->_config['persistent']); } else { @@ -470,7 +465,7 @@ public function add(string $key, $value): bool * If the group initial value was not found, then it initializes * the group accordingly. * - * @return string[] + * @return array */ public function groups(): array { diff --git a/app/vendor/cakephp/cakephp/src/Cache/Engine/RedisEngine.php b/app/vendor/cakephp/cakephp/src/Cache/Engine/RedisEngine.php index 1eeed8ca..b7f0fec4 100644 --- a/app/vendor/cakephp/cakephp/src/Cache/Engine/RedisEngine.php +++ b/app/vendor/cakephp/cakephp/src/Cache/Engine/RedisEngine.php @@ -51,7 +51,7 @@ class RedisEngine extends CacheEngine * - `timeout` timeout in seconds (float). * - `unix_socket` Path to the unix socket file (default: false) * - * @var array + * @var array */ protected $_defaultConfig = [ 'database' => 0, @@ -72,7 +72,7 @@ class RedisEngine extends CacheEngine * * Called automatically by the cache frontend * - * @param array $config array of setting for the engine + * @param array $config array of setting for the engine * @return bool True if the engine has been successfully initialized, false if not */ public function init(array $config = []): bool @@ -283,7 +283,7 @@ public function add(string $key, $value): bool * If the group initial value was not found, then it initializes * the group accordingly. * - * @return string[] + * @return array */ public function groups(): array { diff --git a/app/vendor/cakephp/cakephp/src/Cache/Engine/WincacheEngine.php b/app/vendor/cakephp/cakephp/src/Cache/Engine/WincacheEngine.php index 9d9e36eb..ca0388e4 100644 --- a/app/vendor/cakephp/cakephp/src/Cache/Engine/WincacheEngine.php +++ b/app/vendor/cakephp/cakephp/src/Cache/Engine/WincacheEngine.php @@ -30,7 +30,7 @@ class WincacheEngine extends CacheEngine * Contains the compiled group names * (prefixed with the global configuration prefix) * - * @var array + * @var array */ protected $_compiledGroupNames = []; @@ -39,7 +39,7 @@ class WincacheEngine extends CacheEngine * * Called automatically by the cache frontend * - * @param array $config array of setting for the engine + * @param array $config array of setting for the engine * @return bool True if the engine has been successfully initialized, false if not */ public function init(array $config = []): bool @@ -155,7 +155,7 @@ public function clear(): bool * If the group initial value was not found, then it initializes * the group accordingly. * - * @return string[] + * @return array */ public function groups(): array { diff --git a/app/vendor/cakephp/cakephp/src/Cache/composer.json b/app/vendor/cakephp/cakephp/src/Cache/composer.json index f78e504a..001a8a9d 100644 --- a/app/vendor/cakephp/cakephp/src/Cache/composer.json +++ b/app/vendor/cakephp/cakephp/src/Cache/composer.json @@ -24,7 +24,7 @@ "require": { "php": ">=7.2.0", "cakephp/core": "^4.0", - "psr/simple-cache": "^1.0.0" + "psr/simple-cache": "^1.0 || ^2.0" }, "provide": { "psr/simple-cache-implementation": "^1.0.0" diff --git a/app/vendor/cakephp/cakephp/src/Collection/Collection.php b/app/vendor/cakephp/cakephp/src/Collection/Collection.php index 645b2813..d3af8c0f 100644 --- a/app/vendor/cakephp/cakephp/src/Collection/Collection.php +++ b/app/vendor/cakephp/cakephp/src/Collection/Collection.php @@ -54,6 +54,16 @@ public function serialize(): string return serialize($this->buffered()); } + /** + * Returns an array for serializing this of this object. + * + * @return array + */ + public function __serialize(): array + { + return $this->buffered()->toArray(); + } + /** * Unserializes the passed string and rebuilds the Collection instance * @@ -65,6 +75,17 @@ public function unserialize($collection): void $this->__construct(unserialize($collection)); } + /** + * Rebuilds the Collection instance. + * + * @param array $data Data array. + * @return void + */ + public function __unserialize(array $data): void + { + $this->__construct($data); + } + /** * {@inheritDoc} * @@ -95,7 +116,7 @@ public function countKeys(): int * Returns an array that can be used to describe the internal state of this * object. * - * @return array + * @return array */ public function __debugInfo(): array { diff --git a/app/vendor/cakephp/cakephp/src/Collection/CollectionInterface.php b/app/vendor/cakephp/cakephp/src/Collection/CollectionInterface.php index 986e6397..12cbb1c3 100644 --- a/app/vendor/cakephp/cakephp/src/Collection/CollectionInterface.php +++ b/app/vendor/cakephp/cakephp/src/Collection/CollectionInterface.php @@ -64,7 +64,7 @@ public function each(callable $callback); * ``` * * @param callable|null $callback the method that will receive each of the elements and - * returns true whether or not they should be in the resulting collection. + * returns true whether they should be in the resulting collection. * If left null, a callback that filters out falsey values will be used. * @return self */ @@ -90,7 +90,7 @@ public function filter(?callable $callback = null): CollectionInterface; * ``` * * @param callable $callback the method that will receive each of the elements and - * returns true whether or not they should be out of the resulting collection. + * returns true whether they should be out of the resulting collection. * @return self */ public function reject(callable $callback): CollectionInterface; @@ -99,9 +99,8 @@ public function reject(callable $callback): CollectionInterface; * Returns true if all values in this collection pass the truth test provided * in the callback. * - * Each time the callback is executed it will receive the value of the element - * in the current iteration and the key of the element as arguments, in that - * order. + * The callback is passed the value and key of the element being tested and should + * return true if the test passed. * * ### Example: * @@ -111,7 +110,7 @@ public function reject(callable $callback): CollectionInterface; * }); * ``` * - * Empty collections always return true because it is a vacuous truth. + * Empty collections always return true. * * @param callable $callback a callback function * @return bool true if for all elements in this collection the provided @@ -123,14 +122,13 @@ public function every(callable $callback): bool; * Returns true if any of the values in this collection pass the truth test * provided in the callback. * - * Each time the callback is executed it will receive the value of the element - * in the current iteration and the key of the element as arguments, in that - * order. + * The callback is passed the value and key of the element being tested and should + * return true if the test passed. * * ### Example: * * ``` - * $hasYoungPeople = (new Collection([24, 45, 15]))->every(function ($value, $key) { + * $hasYoungPeople = (new Collection([24, 45, 15]))->some(function ($value, $key) { * return $value < 21; * }); * ``` @@ -226,7 +224,7 @@ public function reduce(callable $callback, $initial = null); * [1, 2, 3, 4] * ``` * - * @param string|callable $path A dot separated path of column to follow + * @param callable|string $path A dot separated path of column to follow * so that the final one can be returned or a callable that will take care * of doing that. * @return self @@ -308,7 +306,7 @@ public function min($path, int $sort = \SORT_NUMERIC); * The average of an empty set or 0 rows is `null`. Collections with `null` * values are not considered empty. * - * @param string|callable|null $path The property name to sum or a function + * @param callable|string|null $path The property name to sum or a function * If no value is passed, an identity function will be used. * that will return the value of the property to sum. * @return float|int|null @@ -341,7 +339,7 @@ public function avg($path = null); * The median of an empty set or 0 rows is `null`. Collections with `null` * values are not considered empty. * - * @param string|callable|null $path The property name to sum or a function + * @param callable|string|null $path The property name to sum or a function * If no value is passed, an identity function will be used. * that will return the value of the property to sum. * @return float|int|null @@ -526,7 +524,7 @@ public function countBy($path): CollectionInterface; * // Total: 6 * ``` * - * @param string|callable|null $path The property name to sum or a function + * @param callable|string|null $path The property name to sum or a function * If no value is passed, an identity function will be used. * that will return the value of the property to sum. * @return float|int @@ -619,7 +617,7 @@ public function skip(int $length): CollectionInterface; public function match(array $conditions): CollectionInterface; /** - * Returns the first result matching all of the key-value pairs listed in + * Returns the first result matching all the key-value pairs listed in * conditions. * * @param array $conditions a key-value list of conditions where the key is @@ -775,13 +773,13 @@ public function insert(string $path, $values): CollectionInterface; /** * Returns an array representation of the results * - * @param bool $preserveKeys whether to use the keys returned by this + * @param bool $keepKeys Whether to use the keys returned by this * collection as the array keys. Keep in mind that it is valid for iterators * to return the same key for different elements, setting this value to false * can help getting all items if keys are not important in the result. * @return array */ - public function toArray(bool $preserveKeys = true): array; + public function toArray(bool $keepKeys = true): array; /** * Returns an numerically-indexed array representation of the results. @@ -827,13 +825,13 @@ public function jsonSerialize(): array; * You can think of this method as a way to create save points for complex * calculations in a collection. * - * @param bool $preserveKeys whether to use the keys returned by this + * @param bool $keepKeys Whether to use the keys returned by this * collection as the array keys. Keep in mind that it is valid for iterators * to return the same key for different elements, setting this value to false * can help getting all items if keys are not important in the result. * @return self */ - public function compile(bool $preserveKeys = true): CollectionInterface; + public function compile(bool $keepKeys = true): CollectionInterface; /** * Returns a new collection where any operations chained after it are guaranteed @@ -891,7 +889,7 @@ public function buffered(): CollectionInterface; * ``` * * @param string|int $order The order in which to return the elements - * @param string|callable $nestingKey The key name under which children are nested + * @param callable|string $nestingKey The key name under which children are nested * or a callable function that will return the children list * @return self */ @@ -1052,13 +1050,13 @@ public function chunk(int $chunkSize): CollectionInterface; * ``` * * @param int $chunkSize The maximum size for each chunk - * @param bool $preserveKeys If the keys of the array should be preserved + * @param bool $keepKeys If the keys of the array should be kept * @return self */ - public function chunkWithKeys(int $chunkSize, bool $preserveKeys = true): CollectionInterface; + public function chunkWithKeys(int $chunkSize, bool $keepKeys = true): CollectionInterface; /** - * Returns whether or not there are elements in this collection + * Returns whether there are elements in this collection * * ### Example: * diff --git a/app/vendor/cakephp/cakephp/src/Collection/CollectionTrait.php b/app/vendor/cakephp/cakephp/src/Collection/CollectionTrait.php index 18ccbafe..010b06a6 100644 --- a/app/vendor/cakephp/cakephp/src/Collection/CollectionTrait.php +++ b/app/vendor/cakephp/cakephp/src/Collection/CollectionTrait.php @@ -673,21 +673,21 @@ public function insert(string $path, $values): CollectionInterface /** * @inheritDoc */ - public function toArray(bool $preserveKeys = true): array + public function toArray(bool $keepKeys = true): array { $iterator = $this->unwrap(); if ($iterator instanceof ArrayIterator) { $items = $iterator->getArrayCopy(); - return $preserveKeys ? $items : array_values($items); + return $keepKeys ? $items : array_values($items); } // RecursiveIteratorIterator can return duplicate key values causing // data loss when converted into an array - if ($preserveKeys && get_class($iterator) === RecursiveIteratorIterator::class) { - $preserveKeys = false; + if ($keepKeys && get_class($iterator) === RecursiveIteratorIterator::class) { + $keepKeys = false; } - return iterator_to_array($this, $preserveKeys); + return iterator_to_array($this, $keepKeys); } /** @@ -709,9 +709,9 @@ public function jsonSerialize(): array /** * @inheritDoc */ - public function compile(bool $preserveKeys = true): CollectionInterface + public function compile(bool $keepKeys = true): CollectionInterface { - return $this->newCollection($this->toArray($preserveKeys)); + return $this->newCollection($this->toArray($keepKeys)); } /** @@ -850,11 +850,11 @@ public function chunk(int $chunkSize): CollectionInterface /** * @inheritDoc */ - public function chunkWithKeys(int $chunkSize, bool $preserveKeys = true): CollectionInterface + public function chunkWithKeys(int $chunkSize, bool $keepKeys = true): CollectionInterface { - return $this->map(function ($v, $k, $iterator) use ($chunkSize, $preserveKeys) { + return $this->map(function ($v, $k, $iterator) use ($chunkSize, $keepKeys) { $key = 0; - if ($preserveKeys) { + if ($keepKeys) { $key = $k; } $values = [$key => $v]; @@ -863,7 +863,7 @@ public function chunkWithKeys(int $chunkSize, bool $preserveKeys = true): Collec if (!$iterator->valid()) { break; } - if ($preserveKeys) { + if ($keepKeys) { $values[$iterator->key()] = $iterator->current(); } else { $values[] = $iterator->current(); diff --git a/app/vendor/cakephp/cakephp/src/Collection/ExtractTrait.php b/app/vendor/cakephp/cakephp/src/Collection/ExtractTrait.php index 81cc8d14..c9b69a58 100644 --- a/app/vendor/cakephp/cakephp/src/Collection/ExtractTrait.php +++ b/app/vendor/cakephp/cakephp/src/Collection/ExtractTrait.php @@ -29,7 +29,7 @@ trait ExtractTrait * Returns a callable that can be used to extract a property or column from * an array or object based on a dot separated path. * - * @param string|callable $path A dot separated path of column to follow + * @param callable|string $path A dot separated path of column to follow * so that the final one can be returned or a callable that will take care * of doing that. * @return callable @@ -58,8 +58,8 @@ protected function _propertyExtractor($path): callable * by iterating over the column names contained in $path. * It will return arrays for elements in represented with `{*}` * - * @param array|\ArrayAccess $data Data. - * @param string[] $parts Path to extract from. + * @param \ArrayAccess|array $data Data. + * @param array $parts Path to extract from. * @return mixed */ protected function _extract($data, array $parts) @@ -104,8 +104,8 @@ protected function _extract($data, array $parts) * Returns a column from $data that can be extracted * by iterating over the column names contained in $path * - * @param array|\ArrayAccess $data Data. - * @param string[] $parts Path to extract from. + * @param \ArrayAccess|array $data Data. + * @param array $parts Path to extract from. * @return mixed */ protected function _simpleExtract($data, array $parts) @@ -123,7 +123,7 @@ protected function _simpleExtract($data, array $parts) } /** - * Returns a callable that receives a value and will return whether or not + * Returns a callable that receives a value and will return whether * it matches certain condition. * * @param array $conditions A key-value list of conditions to match where the diff --git a/app/vendor/cakephp/cakephp/src/Collection/Iterator/BufferedIterator.php b/app/vendor/cakephp/cakephp/src/Collection/Iterator/BufferedIterator.php index 5c46c919..cdf1c4ef 100644 --- a/app/vendor/cakephp/cakephp/src/Collection/Iterator/BufferedIterator.php +++ b/app/vendor/cakephp/cakephp/src/Collection/Iterator/BufferedIterator.php @@ -56,7 +56,7 @@ class BufferedIterator extends Collection implements Countable, Serializable protected $_key; /** - * Whether or not the internal iterator's rewind method was already + * Whether the internal iterator's rewind method was already * called * * @var bool @@ -64,7 +64,7 @@ class BufferedIterator extends Collection implements Countable, Serializable protected $_started = false; /** - * Whether or not the internal iterator has reached its end. + * Whether the internal iterator has reached its end. * * @var bool */ @@ -87,6 +87,7 @@ public function __construct(iterable $items) * * @return mixed */ + #[\ReturnTypeWillChange] public function key() { return $this->_key; @@ -97,6 +98,7 @@ public function key() * * @return mixed */ + #[\ReturnTypeWillChange] public function current() { return $this->_current; @@ -120,7 +122,7 @@ public function rewind(): void } /** - * Returns whether or not the iterator has more elements + * Returns whether the iterator has more elements * * @return bool */ @@ -201,6 +203,20 @@ public function serialize(): string return serialize($this->_buffer); } + /** + * Magic method used for serializing the iterator instance. + * + * @return array + */ + public function __serialize(): array + { + if (!$this->_finished) { + $this->count(); + } + + return iterator_to_array($this->_buffer); + } + /** * Unserializes the passed string and rebuilds the BufferedIterator instance * @@ -214,4 +230,22 @@ public function unserialize($collection): void $this->_started = true; $this->_finished = true; } + + /** + * Magic method used to rebuild the iterator instance. + * + * @param array $data Data array. + * @return void + */ + public function __unserialize(array $data): void + { + $this->__construct([]); + + foreach ($data as $value) { + $this->_buffer->push($value); + } + + $this->_started = true; + $this->_finished = true; + } } diff --git a/app/vendor/cakephp/cakephp/src/Collection/Iterator/ExtractIterator.php b/app/vendor/cakephp/cakephp/src/Collection/Iterator/ExtractIterator.php index c8299708..f5ba7b97 100644 --- a/app/vendor/cakephp/cakephp/src/Collection/Iterator/ExtractIterator.php +++ b/app/vendor/cakephp/cakephp/src/Collection/Iterator/ExtractIterator.php @@ -52,7 +52,7 @@ class ExtractIterator extends Collection * ``` * * @param iterable $items The list of values to iterate - * @param string|callable $path A dot separated path of column to follow + * @param callable|string $path A dot separated path of column to follow * so that the final one can be returned or a callable that will take care * of doing that. */ @@ -68,6 +68,7 @@ public function __construct(iterable $items, $path) * * @return mixed */ + #[\ReturnTypeWillChange] public function current() { $extractor = $this->_extractor; diff --git a/app/vendor/cakephp/cakephp/src/Collection/Iterator/InsertIterator.php b/app/vendor/cakephp/cakephp/src/Collection/Iterator/InsertIterator.php index a452e788..8bcffc44 100644 --- a/app/vendor/cakephp/cakephp/src/Collection/Iterator/InsertIterator.php +++ b/app/vendor/cakephp/cakephp/src/Collection/Iterator/InsertIterator.php @@ -44,7 +44,7 @@ class InsertIterator extends Collection * An array containing each of the properties to be traversed to reach the * point where the values should be inserted. * - * @var array + * @var array */ protected $_path; @@ -101,6 +101,7 @@ public function next(): void * * @return mixed */ + #[\ReturnTypeWillChange] public function current() { $row = parent::current(); diff --git a/app/vendor/cakephp/cakephp/src/Collection/Iterator/NestIterator.php b/app/vendor/cakephp/cakephp/src/Collection/Iterator/NestIterator.php index 408c7af2..c60c39b2 100644 --- a/app/vendor/cakephp/cakephp/src/Collection/Iterator/NestIterator.php +++ b/app/vendor/cakephp/cakephp/src/Collection/Iterator/NestIterator.php @@ -29,7 +29,7 @@ class NestIterator extends Collection implements RecursiveIterator /** * The name of the property that contains the nested items for each element * - * @var string|callable + * @var callable|string */ protected $_nestKey; @@ -37,7 +37,7 @@ class NestIterator extends Collection implements RecursiveIterator * Constructor * * @param iterable $items Collection items. - * @param string|callable $nestKey the property that contains the nested items + * @param callable|string $nestKey the property that contains the nested items * If a callable is passed, it should return the childrens for the passed item */ public function __construct(iterable $items, $nestKey) @@ -51,7 +51,7 @@ public function __construct(iterable $items, $nestKey) * * @return \RecursiveIterator */ - public function getChildren() + public function getChildren(): RecursiveIterator { $property = $this->_propertyExtractor($this->_nestKey); diff --git a/app/vendor/cakephp/cakephp/src/Collection/Iterator/NoChildrenIterator.php b/app/vendor/cakephp/cakephp/src/Collection/Iterator/NoChildrenIterator.php index 49ac8111..ed940c1c 100644 --- a/app/vendor/cakephp/cakephp/src/Collection/Iterator/NoChildrenIterator.php +++ b/app/vendor/cakephp/cakephp/src/Collection/Iterator/NoChildrenIterator.php @@ -41,7 +41,7 @@ public function hasChildren(): bool * * @return \RecursiveIterator */ - public function getChildren() + public function getChildren(): RecursiveIterator { return new static([]); } diff --git a/app/vendor/cakephp/cakephp/src/Collection/Iterator/ReplaceIterator.php b/app/vendor/cakephp/cakephp/src/Collection/Iterator/ReplaceIterator.php index 1793dbb5..285757a6 100644 --- a/app/vendor/cakephp/cakephp/src/Collection/Iterator/ReplaceIterator.php +++ b/app/vendor/cakephp/cakephp/src/Collection/Iterator/ReplaceIterator.php @@ -65,6 +65,7 @@ public function __construct(iterable $items, callable $callback) * * @return mixed */ + #[\ReturnTypeWillChange] public function current() { $callback = $this->_callback; diff --git a/app/vendor/cakephp/cakephp/src/Collection/Iterator/StoppableIterator.php b/app/vendor/cakephp/cakephp/src/Collection/Iterator/StoppableIterator.php index ac626a44..d79de678 100644 --- a/app/vendor/cakephp/cakephp/src/Collection/Iterator/StoppableIterator.php +++ b/app/vendor/cakephp/cakephp/src/Collection/Iterator/StoppableIterator.php @@ -66,7 +66,7 @@ public function __construct(iterable $items, callable $condition) /** * Evaluates the condition and returns its result, this controls - * whether or not more results will be yielded. + * whether more results will be yielded. * * @return bool */ diff --git a/app/vendor/cakephp/cakephp/src/Collection/Iterator/TreeIterator.php b/app/vendor/cakephp/cakephp/src/Collection/Iterator/TreeIterator.php index 9a9b7ef6..49a28fe0 100644 --- a/app/vendor/cakephp/cakephp/src/Collection/Iterator/TreeIterator.php +++ b/app/vendor/cakephp/cakephp/src/Collection/Iterator/TreeIterator.php @@ -82,9 +82,9 @@ public function __construct( * }); * ``` * - * @param string|callable $valuePath The property to extract or a callable to return + * @param callable|string $valuePath The property to extract or a callable to return * the display value - * @param string|callable|null $keyPath The property to use as iteration key or a + * @param callable|string|null $keyPath The property to use as iteration key or a * callable returning the key value. * @param string $spacer The string to use for prefixing the values according to * their depth in the tree diff --git a/app/vendor/cakephp/cakephp/src/Collection/Iterator/TreePrinter.php b/app/vendor/cakephp/cakephp/src/Collection/Iterator/TreePrinter.php index 2ac181fb..d509d471 100644 --- a/app/vendor/cakephp/cakephp/src/Collection/Iterator/TreePrinter.php +++ b/app/vendor/cakephp/cakephp/src/Collection/Iterator/TreePrinter.php @@ -61,9 +61,9 @@ class TreePrinter extends RecursiveIteratorIterator implements CollectionInterfa * Constructor * * @param \RecursiveIterator $items The iterator to flatten. - * @param string|callable $valuePath The property to extract or a callable to return + * @param callable|string $valuePath The property to extract or a callable to return * the display value. - * @param string|callable $keyPath The property to use as iteration key or a + * @param callable|string $keyPath The property to use as iteration key or a * callable returning the key value. * @param string $spacer The string to use for prefixing the values according to * their depth in the tree. @@ -87,6 +87,7 @@ public function __construct( * * @return mixed */ + #[\ReturnTypeWillChange] public function key() { $extractor = $this->_key; diff --git a/app/vendor/cakephp/cakephp/src/Collection/Iterator/UnfoldIterator.php b/app/vendor/cakephp/cakephp/src/Collection/Iterator/UnfoldIterator.php index dff2bdc7..017373eb 100644 --- a/app/vendor/cakephp/cakephp/src/Collection/Iterator/UnfoldIterator.php +++ b/app/vendor/cakephp/cakephp/src/Collection/Iterator/UnfoldIterator.php @@ -77,7 +77,7 @@ public function hasChildren(): bool * * @return \RecursiveIterator */ - public function getChildren() + public function getChildren(): RecursiveIterator { $current = $this->current(); $key = $this->key(); diff --git a/app/vendor/cakephp/cakephp/src/Collection/Iterator/ZipIterator.php b/app/vendor/cakephp/cakephp/src/Collection/Iterator/ZipIterator.php index 3ab17e83..e032faf7 100644 --- a/app/vendor/cakephp/cakephp/src/Collection/Iterator/ZipIterator.php +++ b/app/vendor/cakephp/cakephp/src/Collection/Iterator/ZipIterator.php @@ -90,6 +90,7 @@ public function __construct(array $sets, ?callable $callable = null) * * @return array */ + #[\ReturnTypeWillChange] public function current() { if ($this->_callback === null) { @@ -110,6 +111,16 @@ public function serialize(): string return serialize($this->_iterators); } + /** + * Magic method used for serializing the iterator instance. + * + * @return array + */ + public function __serialize(): array + { + return $this->_iterators; + } + /** * Unserializes the passed string and rebuilds the ZipIterator instance * @@ -124,4 +135,20 @@ public function unserialize($iterators): void $this->attachIterator($it); } } + + /** + * Magic method used to rebuild the iterator instance. + * + * @param array $data Data array. + * @return void + */ + public function __unserialize(array $data): void + { + parent::__construct(MultipleIterator::MIT_NEED_ALL | MultipleIterator::MIT_KEYS_NUMERIC); + + $this->_iterators = $data; + foreach ($this->_iterators as $it) { + $this->attachIterator($it); + } + } } diff --git a/app/vendor/cakephp/cakephp/src/Collection/functions.php b/app/vendor/cakephp/cakephp/src/Collection/functions.php index 947dd6c4..0440f10f 100644 --- a/app/vendor/cakephp/cakephp/src/Collection/functions.php +++ b/app/vendor/cakephp/cakephp/src/Collection/functions.php @@ -20,7 +20,7 @@ if (!function_exists('collection')) { /** - * Returns a new Cake\Collection\Collection object wrapping the passed argument. + * Returns a new {@link \Cake\Collection\Collection} object wrapping the passed argument. * * @param iterable $items The items from which the collection will be built. * @return \Cake\Collection\Collection diff --git a/app/vendor/cakephp/cakephp/src/Command/Command.php b/app/vendor/cakephp/cakephp/src/Command/Command.php index 95cde0ec..5c6afc02 100644 --- a/app/vendor/cakephp/cakephp/src/Command/Command.php +++ b/app/vendor/cakephp/cakephp/src/Command/Command.php @@ -48,6 +48,9 @@ public function __construct() return $this->getTableLocator()->get($alias); }); + if ($this->defaultTable !== null) { + $this->modelClass = $this->defaultTable; + } if (isset($this->modelClass)) { $this->loadModel(); } diff --git a/app/vendor/cakephp/cakephp/src/Command/CompletionCommand.php b/app/vendor/cakephp/cakephp/src/Command/CompletionCommand.php index b666fcbc..77a5f901 100644 --- a/app/vendor/cakephp/cakephp/src/Command/CompletionCommand.php +++ b/app/vendor/cakephp/cakephp/src/Command/CompletionCommand.php @@ -147,7 +147,7 @@ protected function getCommands(Arguments $args, ConsoleIo $io): int protected function getSubcommands(Arguments $args, ConsoleIo $io): int { $name = $args->getArgument('command'); - if ($name === null || !strlen($name)) { + if ($name === null || $name === '') { return static::CODE_SUCCESS; } @@ -185,7 +185,7 @@ protected function getSubcommands(Arguments $args, ConsoleIo $io): int * Reflect the subcommands names out of a shell. * * @param \Cake\Console\Shell $shell The shell to get commands for - * @return string[] A list of commands + * @return array A list of commands */ protected function shellSubcommands(Shell $shell): array { diff --git a/app/vendor/cakephp/cakephp/src/Command/I18nExtractCommand.php b/app/vendor/cakephp/cakephp/src/Command/I18nExtractCommand.php index a90815bd..891f6d8e 100644 --- a/app/vendor/cakephp/cakephp/src/Command/I18nExtractCommand.php +++ b/app/vendor/cakephp/cakephp/src/Command/I18nExtractCommand.php @@ -41,14 +41,14 @@ public static function defaultName(): string /** * Paths to use when looking for strings * - * @var string[] + * @var array */ protected $_paths = []; /** * Files from where to extract * - * @var string[] + * @var array */ protected $_files = []; @@ -59,13 +59,6 @@ public static function defaultName(): string */ protected $_merge = false; - /** - * Use relative paths in the pot files rather than full path - * - * @var bool - */ - protected $_relativePaths = false; - /** * Current file being processed * @@ -74,9 +67,9 @@ public static function defaultName(): string protected $_file = ''; /** - * Contains all content waiting to be write + * Contains all content waiting to be written * - * @var array + * @var array */ protected $_storage = []; @@ -90,7 +83,7 @@ public static function defaultName(): string /** * Extracted strings indexed by domain. * - * @var array + * @var array */ protected $_translations = []; @@ -104,7 +97,7 @@ public static function defaultName(): string /** * An array of directories to exclude. * - * @var string[] + * @var array */ protected $_exclude = []; @@ -267,7 +260,6 @@ public function execute(Arguments $args, ConsoleIo $io): ?int } $this->_markerError = (bool)$args->getOption('marker-error'); - $this->_relativePaths = (bool)$args->getOption('relative-paths'); if (empty($this->_files)) { $this->_searchFiles(); @@ -368,10 +360,6 @@ public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionPar 'help' => 'Merge all domain strings into a single default.po file.', 'default' => 'no', 'choices' => ['yes', 'no'], - ])->addOption('relative-paths', [ - 'help' => 'Use application relative paths in the .pot file.', - 'boolean' => true, - 'default' => false, ])->addOption('output', [ 'help' => 'Full path to output directory.', ])->addOption('files', [ @@ -382,7 +370,8 @@ public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionPar 'help' => 'Ignores all files in plugins if this command is run inside from the same app directory.', ])->addOption('plugin', [ 'help' => 'Extracts tokens only from the plugin specified and ' - . 'puts the result in the plugin\'s Locale directory.', + . 'puts the result in the plugin\'s `locales` directory.', + 'short' => 'p', ])->addOption('exclude', [ 'help' => 'Comma separated list of directories to exclude.' . ' Any path containing a path segment with the provided values will be skipped. E.g. test,vendors', @@ -511,9 +500,7 @@ protected function _parse(ConsoleIo $io, string $functionName, array $map): void 'file' => $this->_file, 'line' => $line, ]; - if ($this->_relativePaths) { - $details['file'] = '.' . str_replace(ROOT, '', $details['file']); - } + $details['file'] = '.' . str_replace(ROOT, '', $details['file']); if ($plural !== null) { $details['msgid_plural'] = $plural; } @@ -563,7 +550,7 @@ protected function _buildFiles(Arguments $args): void $occurrences = implode("\n#: ", $occurrences); $header = '#: ' - . str_replace(DIRECTORY_SEPARATOR, '/', str_replace($paths, '', $occurrences)) + . str_replace(DIRECTORY_SEPARATOR, '/', $occurrences) . "\n"; } @@ -601,9 +588,8 @@ protected function _buildFiles(Arguments $args): void */ protected function _store(string $domain, string $header, string $sentence): void { - if (!isset($this->_storage[$domain])) { - $this->_storage[$domain] = []; - } + $this->_storage[$domain] = $this->_storage[$domain] ?? []; + if (!isset($this->_storage[$domain][$sentence])) { $this->_storage[$domain][$sentence] = $header; } else { @@ -706,7 +692,7 @@ protected function _writeHeader(string $domain): string * @param string $oldFile The existing file. * @param int $headerLength The length of the file header in bytes. * @param string $newFileContent The content of the new file. - * @return bool Whether or not the old and new file are unchanged. + * @return bool Whether the old and new file are unchanged. */ protected function checkUnchanged(string $oldFile, int $headerLength, string $newFileContent): bool { @@ -731,7 +717,7 @@ protected function checkUnchanged(string $oldFile, int $headerLength, string $ne protected function _getStrings(int &$position, int $target): array { $strings = []; - $count = count($strings); + $count = 0; while ( $count < $target && ($this->_tokens[$position] === ',' @@ -873,7 +859,7 @@ protected function _isExtractingApp(): bool } /** - * Checks whether or not a given path is usable for writing. + * Checks whether a given path is usable for writing. * * @param string $path Path to folder * @return bool true if it exists and is writable, false otherwise diff --git a/app/vendor/cakephp/cakephp/src/Command/PluginAssetsCopyCommand.php b/app/vendor/cakephp/cakephp/src/Command/PluginAssetsCopyCommand.php index 8cc8a5c3..8f507423 100644 --- a/app/vendor/cakephp/cakephp/src/Command/PluginAssetsCopyCommand.php +++ b/app/vendor/cakephp/cakephp/src/Command/PluginAssetsCopyCommand.php @@ -71,7 +71,7 @@ public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionPar 'Copy plugin assets to app\'s webroot.', ])->addArgument('name', [ 'help' => 'A specific plugin you want to copy assets for.', - 'optional' => true, + 'required' => false, ])->addOption('overwrite', [ 'help' => 'Overwrite existing symlink / folder / files.', 'default' => false, diff --git a/app/vendor/cakephp/cakephp/src/Command/PluginAssetsRemoveCommand.php b/app/vendor/cakephp/cakephp/src/Command/PluginAssetsRemoveCommand.php index 9a75911b..f4cf1ed7 100644 --- a/app/vendor/cakephp/cakephp/src/Command/PluginAssetsRemoveCommand.php +++ b/app/vendor/cakephp/cakephp/src/Command/PluginAssetsRemoveCommand.php @@ -80,7 +80,7 @@ public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionPar 'Remove plugin assets from app\'s webroot.', ])->addArgument('name', [ 'help' => 'A specific plugin you want to remove.', - 'optional' => true, + 'required' => false, ]); return $parser; diff --git a/app/vendor/cakephp/cakephp/src/Command/PluginAssetsSymlinkCommand.php b/app/vendor/cakephp/cakephp/src/Command/PluginAssetsSymlinkCommand.php index f54fba95..103c3e26 100644 --- a/app/vendor/cakephp/cakephp/src/Command/PluginAssetsSymlinkCommand.php +++ b/app/vendor/cakephp/cakephp/src/Command/PluginAssetsSymlinkCommand.php @@ -72,7 +72,7 @@ public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionPar 'Symlink (copy as fallback) plugin assets to app\'s webroot.', ])->addArgument('name', [ 'help' => 'A specific plugin you want to symlink assets for.', - 'optional' => true, + 'required' => false, ])->addOption('overwrite', [ 'help' => 'Overwrite existing symlink / folder / files.', 'default' => false, diff --git a/app/vendor/cakephp/cakephp/src/Command/PluginAssetsTrait.php b/app/vendor/cakephp/cakephp/src/Command/PluginAssetsTrait.php index 9470ff93..8e0ec7ff 100644 --- a/app/vendor/cakephp/cakephp/src/Command/PluginAssetsTrait.php +++ b/app/vendor/cakephp/cakephp/src/Command/PluginAssetsTrait.php @@ -47,7 +47,7 @@ trait PluginAssetsTrait * * @param string|null $name Name of plugin for which to symlink assets. * If null all plugins will be processed. - * @return array List of plugins with meta data. + * @return array List of plugins with meta data. */ protected function _list(?string $name = null): array { @@ -95,7 +95,7 @@ protected function _list(?string $name = null): array /** * Process plugins * - * @param array $plugins List of plugins to process + * @param array $plugins List of plugins to process * @param bool $copy Force copy mode. Default false. * @param bool $overwrite Overwrite existing files. * @return void @@ -153,7 +153,7 @@ protected function _process(array $plugins, bool $copy = false, bool $overwrite /** * Remove folder/symlink. * - * @param array $config Plugin config. + * @param array $config Plugin config. * @return bool */ protected function _remove(array $config): bool diff --git a/app/vendor/cakephp/cakephp/src/Command/PluginLoadCommand.php b/app/vendor/cakephp/cakephp/src/Command/PluginLoadCommand.php index 4897ccae..b4122832 100644 --- a/app/vendor/cakephp/cakephp/src/Command/PluginLoadCommand.php +++ b/app/vendor/cakephp/cakephp/src/Command/PluginLoadCommand.php @@ -63,14 +63,7 @@ public function execute(Arguments $args, ConsoleIo $io): ?int $this->io = $io; $this->args = $args; - $plugin = $args->getArgument('plugin'); - if (!$plugin) { - $this->io->err('You must provide a plugin name in CamelCase format.'); - $this->io->err('To load an "Example" plugin, run `cake plugin load Example`.'); - - return static::CODE_ERROR; - } - + $plugin = $args->getArgument('plugin') ?? ''; try { Plugin::getCollection()->findPath($plugin); } catch (MissingPluginException $e) { @@ -101,19 +94,27 @@ protected function modifyApplication(string $app, string $plugin): void { $contents = file_get_contents($app); - $append = "\n \$this->addPlugin('%s');\n"; - $insert = str_replace(', []', '', sprintf($append, $plugin)); + // Find start of bootstrap + if (!preg_match('/^(\s+)public function bootstrap(?:\s*)\(\)/mu', $contents, $matches, PREG_OFFSET_CAPTURE)) { + $this->io->err('Your Application class does not have a bootstrap() method. Please add one.'); + $this->abort(); + } + + $offset = $matches[0][1]; + $indent = $matches[1][0]; - if (!preg_match('/function bootstrap\(\)(?:\s*)\:(?:\s*)void/m', $contents)) { + // Find closing function bracket + if (!preg_match("/^$indent\}\n$/mu", $contents, $matches, PREG_OFFSET_CAPTURE, $offset)) { $this->io->err('Your Application class does not have a bootstrap() method. Please add one.'); $this->abort(); - } else { - $contents = preg_replace( - '/(function bootstrap\(\)(?:\s*)\:(?:\s*)void(?:\s+)\{)/m', - '$1' . $insert, - $contents - ); } + + $append = "$indent \$this->addPlugin('%s');\n"; + $insert = str_replace(', []', '', sprintf($append, $plugin)); + + $offset = $matches[0][1]; + $contents = substr_replace($contents, $insert, $offset, 0); + file_put_contents($app, $contents); $this->io->out(''); @@ -132,7 +133,8 @@ public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionPar 'Command for loading plugins.', ]) ->addArgument('plugin', [ - 'help' => 'Name of the plugin to load.', + 'help' => 'Name of the plugin to load. Must be in CamelCase format. Example: cake plugin load Example', + 'required' => true, ]); return $parser; diff --git a/app/vendor/cakephp/cakephp/src/Command/RoutesCommand.php b/app/vendor/cakephp/cakephp/src/Command/RoutesCommand.php index 51783740..e3a20b9f 100644 --- a/app/vendor/cakephp/cakephp/src/Command/RoutesCommand.php +++ b/app/vendor/cakephp/cakephp/src/Command/RoutesCommand.php @@ -35,14 +35,42 @@ class RoutesCommand extends Command */ public function execute(Arguments $args, ConsoleIo $io): ?int { - $output = [ - ['Route name', 'URI template', 'Defaults'], - ]; + $header = ['Route name', 'URI template', 'Plugin', 'Prefix', 'Controller', 'Action', 'Method(s)']; + if ($args->getOption('verbose')) { + $header[] = 'Defaults'; + } + + $output = []; + foreach (Router::routes() as $route) { - $name = $route->options['_name'] ?? $route->getName(); - ksort($route->defaults); - $output[] = [$name, $route->template, json_encode($route->defaults)]; + $methods = $route->defaults['_method'] ?? ''; + + $item = [ + $route->options['_name'] ?? $route->getName(), + $route->template, + $route->defaults['plugin'] ?? '', + $route->defaults['prefix'] ?? '', + $route->defaults['controller'] ?? '', + $route->defaults['action'] ?? '', + is_string($methods) ? $methods : implode(', ', $route->defaults['_method']), + ]; + + if ($args->getOption('verbose')) { + ksort($route->defaults); + $item[] = json_encode($route->defaults); + } + + $output[] = $item; + } + + if ($args->getOption('sort')) { + usort($output, function ($a, $b) { + return strcasecmp($a[0], $b[0]); + }); } + + array_unshift($output, $header); + $io->helper('table')->output($output); $io->out(); @@ -57,7 +85,13 @@ public function execute(Arguments $args, ConsoleIo $io): ?int */ public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionParser { - $parser->setDescription('Get the list of routes connected in this application.'); + $parser + ->setDescription('Get the list of routes connected in this application.') + ->addOption('sort', [ + 'help' => 'Sorts alphabetically by route name A-Z', + 'short' => 's', + 'boolean' => true, + ]); return $parser; } diff --git a/app/vendor/cakephp/cakephp/src/Command/RoutesGenerateCommand.php b/app/vendor/cakephp/cakephp/src/Command/RoutesGenerateCommand.php index a2ceaafc..35eae5cc 100644 --- a/app/vendor/cakephp/cakephp/src/Command/RoutesGenerateCommand.php +++ b/app/vendor/cakephp/cakephp/src/Command/RoutesGenerateCommand.php @@ -62,8 +62,8 @@ public function execute(Arguments $args, ConsoleIo $io): ?int /** * Split the CLI arguments into a hash. * - * @param string[] $args The arguments to split. - * @return (string|bool)[] + * @param array $args The arguments to split. + * @return array */ protected function _splitArgs(array $args): array { diff --git a/app/vendor/cakephp/cakephp/src/Command/SchemacacheBuildCommand.php b/app/vendor/cakephp/cakephp/src/Command/SchemacacheBuildCommand.php index e6b30028..cd556a8f 100644 --- a/app/vendor/cakephp/cakephp/src/Command/SchemacacheBuildCommand.php +++ b/app/vendor/cakephp/cakephp/src/Command/SchemacacheBuildCommand.php @@ -85,7 +85,7 @@ public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionPar 'default' => 'default', ])->addArgument('name', [ 'help' => 'A specific table you want to refresh cached data for.', - 'optional' => true, + 'required' => false, ]); return $parser; diff --git a/app/vendor/cakephp/cakephp/src/Command/SchemacacheClearCommand.php b/app/vendor/cakephp/cakephp/src/Command/SchemacacheClearCommand.php index 88d92678..fedf74e2 100644 --- a/app/vendor/cakephp/cakephp/src/Command/SchemacacheClearCommand.php +++ b/app/vendor/cakephp/cakephp/src/Command/SchemacacheClearCommand.php @@ -85,7 +85,7 @@ public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionPar 'default' => 'default', ])->addArgument('name', [ 'help' => 'A specific table you want to clear cached data for.', - 'optional' => true, + 'required' => false, ]); return $parser; diff --git a/app/vendor/cakephp/cakephp/src/Command/ServerCommand.php b/app/vendor/cakephp/cakephp/src/Command/ServerCommand.php index fb32a3ec..69f1203a 100644 --- a/app/vendor/cakephp/cakephp/src/Command/ServerCommand.php +++ b/app/vendor/cakephp/cakephp/src/Command/ServerCommand.php @@ -143,7 +143,7 @@ public function execute(Arguments $args, ConsoleIo $io): ?int $port = ':' . $this->_port; $io->out(sprintf('built-in server is running in http://%s%s/', $this->_host, $port)); - $io->out(sprintf('You can exit with `CTRL-C`')); + $io->out('You can exit with `CTRL-C`'); system($command); return static::CODE_SUCCESS; diff --git a/app/vendor/cakephp/cakephp/src/Console/Arguments.php b/app/vendor/cakephp/cakephp/src/Console/Arguments.php index 02ba0582..5de44d9d 100644 --- a/app/vendor/cakephp/cakephp/src/Console/Arguments.php +++ b/app/vendor/cakephp/cakephp/src/Console/Arguments.php @@ -25,30 +25,30 @@ class Arguments /** * Positional argument name map * - * @var string[] + * @var array */ protected $argNames; /** * Positional arguments. * - * @var string[] + * @var array */ protected $args; /** * Named options * - * @var array + * @var array */ protected $options; /** * Constructor * - * @param string[] $args Positional arguments - * @param array $options Named arguments - * @param string[] $argNames List of argument names. Order is expected to be + * @param array $args Positional arguments + * @param array $options Named arguments + * @param array $argNames List of argument names. Order is expected to be * the same as $args. */ public function __construct(array $args, array $options, array $argNames) @@ -61,7 +61,7 @@ public function __construct(array $args, array $options, array $argNames) /** * Get all positional arguments. * - * @return string[] + * @return array */ public function getArguments(): array { @@ -129,7 +129,7 @@ public function getArgument(string $name): ?string /** * Get an array of all the options * - * @return array + * @return array */ public function getOptions(): array { @@ -144,11 +144,7 @@ public function getOptions(): array */ public function getOption(string $name) { - if (isset($this->options[$name])) { - return $this->options[$name]; - } - - return null; + return $this->options[$name] ?? null; } /** diff --git a/app/vendor/cakephp/cakephp/src/Console/BaseCommand.php b/app/vendor/cakephp/cakephp/src/Console/BaseCommand.php index 18b5ad38..ad4866bf 100644 --- a/app/vendor/cakephp/cakephp/src/Console/BaseCommand.php +++ b/app/vendor/cakephp/cakephp/src/Console/BaseCommand.php @@ -246,9 +246,9 @@ public function abort(int $code = self::CODE_ERROR): void * will not be resolved with the application container. Instead you will * need to pass the command as an object with all of its dependencies. * - * @param string|\Cake\Console\CommandInterface $command The command class name or command instance. + * @param \Cake\Console\CommandInterface|string $command The command class name or command instance. * @param array $args The arguments to invoke the command with. - * @param \Cake\Console\ConsoleIo $io The ConsoleIo instance to use for the executed command. + * @param \Cake\Console\ConsoleIo|null $io The ConsoleIo instance to use for the executed command. * @return int|null The exit code or null for success of the command. */ public function executeCommand($command, array $args = [], ?ConsoleIo $io = null): ?int diff --git a/app/vendor/cakephp/cakephp/src/Console/Command/HelpCommand.php b/app/vendor/cakephp/cakephp/src/Console/Command/HelpCommand.php index 0f9daf06..9999518f 100644 --- a/app/vendor/cakephp/cakephp/src/Console/Command/HelpCommand.php +++ b/app/vendor/cakephp/cakephp/src/Console/Command/HelpCommand.php @@ -164,7 +164,7 @@ protected function outputPaths(ConsoleIo $io): void } /** - * @param string[] $names Names + * @param array $names Names * @return string */ protected function getShortestName(array $names): string diff --git a/app/vendor/cakephp/cakephp/src/Console/CommandCollection.php b/app/vendor/cakephp/cakephp/src/Console/CommandCollection.php index 49528fd6..a3ac801c 100644 --- a/app/vendor/cakephp/cakephp/src/Console/CommandCollection.php +++ b/app/vendor/cakephp/cakephp/src/Console/CommandCollection.php @@ -34,8 +34,8 @@ class CommandCollection implements IteratorAggregate, Countable /** * Command list * - * @var array - * @psalm-var (\Cake\Console\Shell|\Cake\Console\CommandInterface|class-string)[] + * @var array + * @psalm-var array * @psalm-suppress DeprecatedClass */ protected $commands = []; @@ -43,7 +43,7 @@ class CommandCollection implements IteratorAggregate, Countable /** * Constructor * - * @param array $commands The map of commands to add to the collection. + * @param array $commands The map of commands to add to the collection. */ public function __construct(array $commands = []) { @@ -56,7 +56,7 @@ public function __construct(array $commands = []) * Add a command to the collection * * @param string $name The name of the command you want to map. - * @param string|\Cake\Console\Shell|\Cake\Console\CommandInterface $command The command to map. + * @param \Cake\Console\CommandInterface|\Cake\Console\Shell|string $command The command to map. * Can be a FQCN, Shell instance or CommandInterface instance. * @return $this * @throws \InvalidArgumentException @@ -67,7 +67,7 @@ public function add(string $name, $command) $class = is_string($command) ? $command : get_class($command); throw new InvalidArgumentException(sprintf( "Cannot use '%s' for command '%s'. " . - "It is not a subclass of Cake\Console\Shell or Cake\Command\CommandInterface.", + "It is not a subclass of Cake\Console\Shell or Cake\Command\Command.", $class, $name )); @@ -86,7 +86,7 @@ public function add(string $name, $command) /** * Add multiple commands at once. * - * @param array $commands A map of command names => command classes/instances. + * @param array $commands A map of command names => command classes/instances. * @return $this * @see \Cake\Console\CommandCollection::add() */ @@ -127,9 +127,9 @@ public function has(string $name): bool * Get the target for a command. * * @param string $name The named shell. - * @return string|\Cake\Console\Shell|\Cake\Console\CommandInterface Either the command class or an instance. + * @return \Cake\Console\CommandInterface|\Cake\Console\Shell|string Either the command class or an instance. * @throws \InvalidArgumentException when unknown commands are fetched. - * @psalm-return class-string|\Cake\Console\Shell|\Cake\Console\CommandInterface + * @psalm-return \Cake\Console\CommandInterface|\Cake\Console\Shell|class-string */ public function get(string $name) { @@ -172,7 +172,7 @@ public function count(): int * the long name (`plugin.command`) will be returned. * * @param string $plugin The plugin to scan. - * @return string[] Discovered plugin commands. + * @return array Discovered plugin commands. */ public function discoverPlugin(string $plugin): array { @@ -186,7 +186,7 @@ public function discoverPlugin(string $plugin): array * Resolve names based on existing commands * * @param array $input The results of a CommandScanner operation. - * @return string[] A flat map of command names => class names. + * @return array A flat map of command names => class names. */ protected function resolveNames(array $input): array { @@ -223,7 +223,7 @@ protected function resolveNames(array $input): array * Commands defined in the application will overwrite commands with * the same name provided by CakePHP. * - * @return string[] An array of command names and their classes. + * @return array An array of command names and their classes. */ public function autoDiscover(): array { @@ -232,13 +232,13 @@ public function autoDiscover(): array $core = $this->resolveNames($scanner->scanCore()); $app = $this->resolveNames($scanner->scanApp()); - return array_merge($core, $app); + return $app + $core; } /** * Get the list of available command names. * - * @return string[] Command names + * @return array Command names */ public function keys(): array { diff --git a/app/vendor/cakephp/cakephp/src/Console/CommandRunner.php b/app/vendor/cakephp/cakephp/src/Console/CommandRunner.php index 1892eff4..4d6fdfd4 100644 --- a/app/vendor/cakephp/cakephp/src/Console/CommandRunner.php +++ b/app/vendor/cakephp/cakephp/src/Console/CommandRunner.php @@ -64,7 +64,7 @@ class CommandRunner implements EventDispatcherInterface /** * Alias mappings. * - * @var string[] + * @var array */ protected $aliases = []; @@ -103,7 +103,7 @@ public function __construct( * $runner->setAliases(['--version' => 'version']); * ``` * - * @param string[] $aliases The map of aliases to replace. + * @param array $aliases The map of aliases to replace. * @return $this */ public function setAliases(array $aliases) @@ -239,7 +239,7 @@ public function setEventManager(EventManagerInterface $eventManager) * @param \Cake\Console\ConsoleIo $io The IO wrapper for the created shell class. * @param \Cake\Console\CommandCollection $commands The command collection to find the shell in. * @param string $name The command name to find - * @return \Cake\Console\Shell|\Cake\Console\CommandInterface + * @return \Cake\Console\CommandInterface|\Cake\Console\Shell */ protected function getCommand(ConsoleIo $io, CommandCollection $commands, string $name) { @@ -304,9 +304,7 @@ protected function resolveName(CommandCollection $commands, ConsoleIo $io, ?stri $io->err('No command provided. Choose one of the available commands.', 2); $name = 'help'; } - if (isset($this->aliases[$name])) { - $name = $this->aliases[$name]; - } + $name = $this->aliases[$name] ?? $name; if (!$commands->has($name)) { $name = Inflector::underscore($name); } @@ -362,7 +360,7 @@ protected function runShell(Shell $shell, array $argv) * * @param string $className Shell class name. * @param \Cake\Console\ConsoleIo $io The IO wrapper for the created shell class. - * @return \Cake\Console\Shell|\Cake\Console\CommandInterface + * @return \Cake\Console\CommandInterface|\Cake\Console\Shell */ protected function createCommand(string $className, ConsoleIo $io) { diff --git a/app/vendor/cakephp/cakephp/src/Console/CommandScanner.php b/app/vendor/cakephp/cakephp/src/Console/CommandScanner.php index ca4acd86..a704e411 100644 --- a/app/vendor/cakephp/cakephp/src/Console/CommandScanner.php +++ b/app/vendor/cakephp/cakephp/src/Console/CommandScanner.php @@ -105,7 +105,7 @@ public function scanPlugin(string $plugin): array * @param string $path The directory to read. * @param string $namespace The namespace the shells live in. * @param string $prefix The prefix to apply to commands for their full name. - * @param string[] $hide A list of command names to hide as they are internal commands. + * @param array $hide A list of command names to hide as they are internal commands. * @return array The list of shell info arrays based on scanning the filesystem and inflection. */ protected function scanDir(string $path, string $namespace, string $prefix, array $hide): array @@ -119,7 +119,7 @@ protected function scanDir(string $path, string $namespace, string $prefix, arra $classPattern = '/(Shell|Command)\.php$/'; $fs = new Filesystem(); - /** @var \SplFileInfo[] $files */ + /** @var array<\SplFileInfo> $files */ $files = $fs->find($path, $classPattern); $shells = []; diff --git a/app/vendor/cakephp/cakephp/src/Console/ConsoleInput.php b/app/vendor/cakephp/cakephp/src/Console/ConsoleInput.php index 9e4ef7a6..ceb2eb26 100644 --- a/app/vendor/cakephp/cakephp/src/Console/ConsoleInput.php +++ b/app/vendor/cakephp/cakephp/src/Console/ConsoleInput.php @@ -62,7 +62,7 @@ public function read(): ?string if ($this->_canReadline) { $line = readline(''); - if ($line !== false && strlen($line) > 0) { + if ($line !== false && $line !== '') { readline_add_history($line); } } else { diff --git a/app/vendor/cakephp/cakephp/src/Console/ConsoleInputArgument.php b/app/vendor/cakephp/cakephp/src/Console/ConsoleInputArgument.php index e76cfccc..6a39e3e9 100644 --- a/app/vendor/cakephp/cakephp/src/Console/ConsoleInputArgument.php +++ b/app/vendor/cakephp/cakephp/src/Console/ConsoleInputArgument.php @@ -51,17 +51,17 @@ class ConsoleInputArgument /** * An array of valid choices for this argument. * - * @var string[] + * @var array */ protected $_choices; /** * Make a new Input Argument * - * @param string|array $name The long name of the option, or an array with all the properties. + * @param array|string $name The long name of the option, or an array with all the properties. * @param string $help The help text for this option * @param bool $required Whether this argument is required. Missing required args will trigger exceptions - * @param string[] $choices Valid choices for this option. + * @param array $choices Valid choices for this option. */ public function __construct($name, $help = '', $required = false, $choices = []) { diff --git a/app/vendor/cakephp/cakephp/src/Console/ConsoleInputOption.php b/app/vendor/cakephp/cakephp/src/Console/ConsoleInputOption.php index fe29594e..21a253dd 100644 --- a/app/vendor/cakephp/cakephp/src/Console/ConsoleInputOption.php +++ b/app/vendor/cakephp/cakephp/src/Console/ConsoleInputOption.php @@ -72,7 +72,7 @@ class ConsoleInputOption /** * An array of choices for the option. * - * @var string[] + * @var array */ protected $_choices; @@ -91,7 +91,7 @@ class ConsoleInputOption * @param string $help The help text for this option * @param bool $isBoolean Whether this option is a boolean option. Boolean options don't consume extra tokens * @param string|bool|null $default The default value for this option. - * @param string[] $choices Valid choices for this option. + * @param array $choices Valid choices for this option. * @param bool $multiple Whether this option can accept multiple value definition. * @param bool $required Whether this option is required or not. * @throws \Cake\Console\Exception\ConsoleException @@ -162,7 +162,7 @@ public function help(int $width = 0): string if ($this->_choices) { $default .= sprintf(' (choices: %s)', implode('|', $this->_choices)); } - if (strlen($this->_short) > 0) { + if ($this->_short !== '') { $short = ', -' . $this->_short; } $name = sprintf('--%s%s', $this->_name, $short); @@ -184,9 +184,9 @@ public function help(int $width = 0): string */ public function usage(): string { - $name = strlen($this->_short) > 0 ? '-' . $this->_short : '--' . $this->_name; + $name = $this->_short === '' ? '--' . $this->_name : '-' . $this->_short; $default = ''; - if ($this->_default !== null && !is_bool($this->_default) && strlen($this->_default) > 0) { + if ($this->_default !== null && !is_bool($this->_default) && $this->_default !== '') { $default = ' ' . $this->_default; } if ($this->_choices) { @@ -277,7 +277,7 @@ public function xml(SimpleXMLElement $parent): SimpleXMLElement $option = $parent->addChild('option'); $option->addAttribute('name', '--' . $this->_name); $short = ''; - if (strlen($this->_short) > 0) { + if ($this->_short !== '') { $short = '-' . $this->_short; } $default = $this->_default; diff --git a/app/vendor/cakephp/cakephp/src/Console/ConsoleInputSubcommand.php b/app/vendor/cakephp/cakephp/src/Console/ConsoleInputSubcommand.php index 9649a73c..69d2ffea 100644 --- a/app/vendor/cakephp/cakephp/src/Console/ConsoleInputSubcommand.php +++ b/app/vendor/cakephp/cakephp/src/Console/ConsoleInputSubcommand.php @@ -53,9 +53,9 @@ class ConsoleInputSubcommand /** * Make a new Subcommand * - * @param string|array $name The long name of the subcommand, or an array with all the properties. + * @param array|string $name The long name of the subcommand, or an array with all the properties. * @param string $help The help text for this option. - * @param \Cake\Console\ConsoleOptionParser|array|null $parser A parser for this subcommand. + * @param \Cake\Console\ConsoleOptionParser|array|null $parser A parser for this subcommand. * Either a ConsoleOptionParser, or an array that can be used with ConsoleOptionParser::buildFromArray(). */ public function __construct($name, $help = '', $parser = null) diff --git a/app/vendor/cakephp/cakephp/src/Console/ConsoleIo.php b/app/vendor/cakephp/cakephp/src/Console/ConsoleIo.php index a0141c7b..704f7951 100644 --- a/app/vendor/cakephp/cakephp/src/Console/ConsoleIo.php +++ b/app/vendor/cakephp/cakephp/src/Console/ConsoleIo.php @@ -96,7 +96,7 @@ class ConsoleIo protected $_lastWritten = 0; /** - * Whether or not files should be overwritten + * Whether files should be overwritten * * @var bool */ @@ -155,7 +155,7 @@ public function level(?int $level = null): int /** * Output at the verbose level. * - * @param string|string[] $message A string or an array of strings to output + * @param array|string $message A string or an array of strings to output * @param int $newlines Number of newlines to append * @return int|null The number of bytes returned from writing to stdout * or null if current level is less than ConsoleIo::VERBOSE @@ -168,7 +168,7 @@ public function verbose($message, int $newlines = 1): ?int /** * Output at all levels. * - * @param string|string[] $message A string or an array of strings to output + * @param array|string $message A string or an array of strings to output * @param int $newlines Number of newlines to append * @return int|null The number of bytes returned from writing to stdout * or null if current level is less than ConsoleIo::QUIET @@ -189,7 +189,7 @@ public function quiet($message, int $newlines = 1): ?int * present in most shells. Using ConsoleIo::QUIET for a message means it will always display. * While using ConsoleIo::VERBOSE means it will only display when verbose output is toggled. * - * @param string|string[] $message A string or an array of strings to output + * @param array|string $message A string or an array of strings to output * @param int $newlines Number of newlines to append * @param int $level The message's output level, see above. * @return int|null The number of bytes returned from writing to stdout @@ -209,7 +209,7 @@ public function out($message = '', int $newlines = 1, int $level = self::NORMAL) /** * Convenience method for out() that wraps message between tag * - * @param string|string[] $message A string or an array of strings to output + * @param array|string $message A string or an array of strings to output * @param int $newlines Number of newlines to append * @param int $level The message's output level, see above. * @return int|null The number of bytes returned from writing to stdout @@ -227,7 +227,7 @@ public function info($message, int $newlines = 1, int $level = self::NORMAL): ?i /** * Convenience method for out() that wraps message between tag * - * @param string|string[] $message A string or an array of strings to output + * @param array|string $message A string or an array of strings to output * @param int $newlines Number of newlines to append * @param int $level The message's output level, see above. * @return int|null The number of bytes returned from writing to stdout @@ -245,7 +245,7 @@ public function comment($message, int $newlines = 1, int $level = self::NORMAL): /** * Convenience method for err() that wraps message between tag * - * @param string|string[] $message A string or an array of strings to output + * @param array|string $message A string or an array of strings to output * @param int $newlines Number of newlines to append * @return int The number of bytes returned from writing to stderr. * @see https://book.cakephp.org/4/en/console-and-shells.html#ConsoleIo::err @@ -261,7 +261,7 @@ public function warning($message, int $newlines = 1): int /** * Convenience method for err() that wraps message between tag * - * @param string|string[] $message A string or an array of strings to output + * @param array|string $message A string or an array of strings to output * @param int $newlines Number of newlines to append * @return int The number of bytes returned from writing to stderr. * @see https://book.cakephp.org/4/en/console-and-shells.html#ConsoleIo::err @@ -277,7 +277,7 @@ public function error($message, int $newlines = 1): int /** * Convenience method for out() that wraps message between tag * - * @param string|string[] $message A string or an array of strings to output + * @param array|string $message A string or an array of strings to output * @param int $newlines Number of newlines to append * @param int $level The message's output level, see above. * @return int|null The number of bytes returned from writing to stdout @@ -311,8 +311,8 @@ public function abort($message, $code = CommandInterface::CODE_ERROR): void * Wraps a message with a given message type, e.g. * * @param string $messageType The message type, e.g. "warning". - * @param string|string[] $message The message to wrap. - * @return string|string[] The message wrapped with the given message type. + * @param array|string $message The message to wrap. + * @return array|string The message wrapped with the given message type. */ protected function wrapMessageWithType(string $messageType, $message) { @@ -335,7 +335,7 @@ protected function wrapMessageWithType(string $messageType, $message) * * **Warning** You cannot overwrite text that contains newlines. * - * @param array|string $message The message to output. + * @param array|string $message The message to output. * @param int $newlines Number of newlines to append. * @param int|null $size The number of bytes to overwrite. Defaults to the * length of the last message output. @@ -371,7 +371,7 @@ public function overwrite($message, int $newlines = 1, ?int $size = null): void * Outputs a single or multiple error messages to stderr. If no parameters * are passed outputs just a newline. * - * @param string|string[] $message A string or an array of strings to output + * @param array|string $message A string or an array of strings to output * @param int $newlines Number of newlines to append * @return int The number of bytes returned from writing to stderr. */ @@ -469,7 +469,7 @@ public function setStyle(string $style, array $definition): void * Prompts the user for input based on a list of options, and returns it. * * @param string $prompt Prompt text. - * @param string|array $options Array or string of options. + * @param array|string $options Array or string of options. * @param string|null $default Default input value. * @return string Either the default value, or the user-provided input. */ @@ -578,14 +578,14 @@ public function setLoggers($enable): void * object has not already been loaded, it will be loaded and constructed. * * @param string $name The name of the helper to render - * @param array $settings Configuration data for the helper. + * @param array $config Configuration data for the helper. * @return \Cake\Console\Helper The created helper instance. */ - public function helper(string $name, array $settings = []): Helper + public function helper(string $name, array $config = []): Helper { $name = ucfirst($name); - return $this->_helpers->load($name, $settings); + return $this->_helpers->load($name, $config); } /** @@ -600,11 +600,11 @@ public function helper(string $name, array $settings = []): Helper * * @param string $path The path to create the file at. * @param string $contents The contents to put into the file. - * @param bool $forceOverwrite Whether or not the file should be overwritten. - * If true, no question will be asked about whether or not to overwrite existing files. + * @param bool $forceOverwrite Whether the file should be overwritten. + * If true, no question will be asked about whether to overwrite existing files. * @return bool Success. * @throws \Cake\Console\Exception\StopException When `q` is given as an answer - * to whether or not a file should be overwritten. + * to whether a file should be overwritten. */ public function createFile(string $path, string $contents, bool $forceOverwrite = false): bool { diff --git a/app/vendor/cakephp/cakephp/src/Console/ConsoleOptionParser.php b/app/vendor/cakephp/cakephp/src/Console/ConsoleOptionParser.php index 1951d2bd..77044ffc 100644 --- a/app/vendor/cakephp/cakephp/src/Console/ConsoleOptionParser.php +++ b/app/vendor/cakephp/cakephp/src/Console/ConsoleOptionParser.php @@ -95,14 +95,14 @@ class ConsoleOptionParser * Option definitions. * * @see \Cake\Console\ConsoleOptionParser::addOption() - * @var \Cake\Console\ConsoleInputOption[] + * @var array */ protected $_options = []; /** * Map of short -> long options, generated when using addOption() * - * @var array + * @var array */ protected $_shortOptions = []; @@ -110,7 +110,7 @@ class ConsoleOptionParser * Positional argument definitions. * * @see \Cake\Console\ConsoleOptionParser::addArgument() - * @var \Cake\Console\ConsoleInputArgument[] + * @var array<\Cake\Console\ConsoleInputArgument> */ protected $_args = []; @@ -118,7 +118,7 @@ class ConsoleOptionParser * Subcommands for this Shell. * * @see \Cake\Console\ConsoleOptionParser::addSubcommand() - * @var \Cake\Console\ConsoleInputSubcommand[] + * @var array */ protected $_subcommands = []; @@ -212,7 +212,7 @@ public static function create(string $command, bool $defaultOptions = true) * ]; * ``` * - * @param array $spec The spec to build the OptionParser with. + * @param array $spec The spec to build the OptionParser with. * @param bool $defaultOptions Whether you want the verbose and quiet options set. * @return static */ @@ -241,7 +241,7 @@ public static function buildFromArray(array $spec, bool $defaultOptions = true) /** * Returns an array representation of this parser. * - * @return array + * @return array */ public function toArray(): array { @@ -260,7 +260,7 @@ public function toArray(): array /** * Get or set the command name for shell/task. * - * @param array|\Cake\Console\ConsoleOptionParser $spec ConsoleOptionParser or spec to merge with. + * @param \Cake\Console\ConsoleOptionParser|array $spec ConsoleOptionParser or spec to merge with. * @return $this */ public function merge($spec) @@ -313,7 +313,7 @@ public function getCommand(): string /** * Sets the description text for shell/task. * - * @param string|array $text The text to set. If an array the + * @param array|string $text The text to set. If an array the * text will be imploded with "\n". * @return $this */ @@ -341,7 +341,7 @@ public function getDescription(): string * Sets an epilog to the parser. The epilog is added to the end of * the options and arguments listing when help is generated. * - * @param string|array $text The text to set. If an array the text will + * @param array|string $text The text to set. If an array the text will * be imploded with "\n". * @return $this */ @@ -368,7 +368,7 @@ public function getEpilog(): string /** * Enables sorting of subcommands * - * @param bool $value Whether or not to sort subcommands + * @param bool $value Whether to sort subcommands * @return $this */ public function enableSubcommandSort(bool $value = true) @@ -379,7 +379,7 @@ public function enableSubcommandSort(bool $value = true) } /** - * Checks whether or not sorting is enabled for subcommands. + * Checks whether sorting is enabled for subcommands. * * @return bool */ @@ -409,7 +409,7 @@ public function isSubcommandSortEnabled(): bool * * @param \Cake\Console\ConsoleInputOption|string $name The long name you want to the value to be parsed out * as when options are parsed. Will also accept an instance of ConsoleInputOption. - * @param array $options An array of parameters that define the behavior of the option + * @param array $options An array of parameters that define the behavior of the option * @return $this */ public function addOption($name, array $options = []) @@ -477,7 +477,7 @@ public function removeOption(string $name) * * @param \Cake\Console\ConsoleInputArgument|string $name The name of the argument. * Will also accept an instance of ConsoleInputArgument. - * @param array $params Parameters for the argument, see above. + * @param array $params Parameters for the argument, see above. * @return $this */ public function addArgument($name, array $params = []) @@ -537,7 +537,7 @@ public function addArguments(array $args) * Add multiple options at once. Takes an array of option definitions. * The keys are used as option names, and the values as params for the option. * - * @param array $options Array of options to add. + * @param array $options Array of options to add. * @see \Cake\Console\ConsoleOptionParser::addOption() * @return $this */ @@ -567,7 +567,7 @@ public function addOptions(array $options) * * @param \Cake\Console\ConsoleInputSubcommand|string $name Name of the subcommand. * Will also accept an instance of ConsoleInputSubcommand. - * @param array $options Array of params, see above. + * @param array $options Array of params, see above. * @return $this */ public function addSubcommand($name, array $options = []) @@ -610,7 +610,7 @@ public function removeSubcommand(string $name) /** * Add multiple subcommands at once. * - * @param array $commands Array of subcommands. + * @param array $commands Array of subcommands. * @return $this */ public function addSubcommands(array $commands) @@ -629,7 +629,7 @@ public function addSubcommands(array $commands) /** * Gets the arguments defined in the parser. * - * @return \Cake\Console\ConsoleInputArgument[] + * @return array<\Cake\Console\ConsoleInputArgument> */ public function arguments() { @@ -639,7 +639,7 @@ public function arguments() /** * Get the list of argument names. * - * @return string[] + * @return array */ public function argumentNames() { @@ -654,7 +654,7 @@ public function argumentNames() /** * Get the defined options in the parser. * - * @return \Cake\Console\ConsoleInputOption[] + * @return array */ public function options() { @@ -664,7 +664,7 @@ public function options() /** * Get the array of defined subcommands * - * @return \Cake\Console\ConsoleInputSubcommand[] + * @return array */ public function subcommands() { @@ -705,8 +705,13 @@ public function parse(array $argv): array $args = $this->_parseArg($token, $args); } } + + if (isset($params['help'])) { + return [$params, $args]; + } + foreach ($this->_args as $i => $arg) { - if ($arg->isRequired() && !isset($args[$i]) && empty($params['help'])) { + if ($arg->isRequired() && !isset($args[$i])) { throw new ConsoleException( sprintf('Missing required argument. The `%s` argument is required.', $arg->name()) ); @@ -773,7 +778,7 @@ public function help(?string $subcommand = null, string $format = 'text', int $w ->addOptions($this->options()) ->addArguments($this->arguments()); } - if (strlen($subparser->getDescription()) === 0) { + if ($subparser->getDescription() === '') { $subparser->setDescription($command->getRawHelp()); } $subparser->setCommand($this->getCommand() . ' ' . $subcommand); @@ -815,7 +820,7 @@ public function setRootName(string $name) * options with an `=` in them. * * @param string $option The option to parse. - * @param array $params The params to append the parsed value into + * @param array $params The params to append the parsed value into * @return array Params with $option added in. */ protected function _parseLongOption(string $option, array $params): array @@ -835,8 +840,8 @@ protected function _parseLongOption(string $option, array $params): array * they will be shifted onto the token stack and parsed individually. * * @param string $option The option to parse. - * @param array $params The params to append the parsed value into - * @return array Params with $option added in. + * @param array $params The params to append the parsed value into + * @return array Params with $option added in. * @throws \Cake\Console\Exception\ConsoleException When unknown short options are encountered. */ protected function _parseShortOption(string $option, array $params): array @@ -869,8 +874,8 @@ protected function _parseShortOption(string $option, array $params): array * Parse an option by its name index. * * @param string $name The name to parse. - * @param array $params The params to append the parsed value into - * @return array Params with $option added in. + * @param array $params The params to append the parsed value into + * @return array Params with $option added in. * @throws \Cake\Console\Exception\ConsoleException */ protected function _parseOption(string $name, array $params): array @@ -929,7 +934,7 @@ protected function _optionExists(string $name): bool * * @param string $argument The argument to append * @param array $args The array of parsed args to append to. - * @return string[] Args + * @return array Args * @throws \Cake\Console\Exception\ConsoleException */ protected function _parseArg(string $argument, array $args): array diff --git a/app/vendor/cakephp/cakephp/src/Console/ConsoleOutput.php b/app/vendor/cakephp/cakephp/src/Console/ConsoleOutput.php index e009583f..d87fbb39 100644 --- a/app/vendor/cakephp/cakephp/src/Console/ConsoleOutput.php +++ b/app/vendor/cakephp/cakephp/src/Console/ConsoleOutput.php @@ -93,7 +93,7 @@ class ConsoleOutput /** * text colors used in colored output. * - * @var array + * @var array */ protected static $_foregroundColors = [ 'black' => 30, @@ -109,7 +109,7 @@ class ConsoleOutput /** * background colors used in colored output. * - * @var array + * @var array */ protected static $_backgroundColors = [ 'black' => 40, @@ -125,7 +125,7 @@ class ConsoleOutput /** * Formatting options for colored output. * - * @var array + * @var array */ protected static $_options = [ 'bold' => 1, @@ -138,7 +138,7 @@ class ConsoleOutput * Styles that are available as tags in console output. * You can modify these styles with ConsoleOutput::styles() * - * @var array + * @var array */ protected static $_styles = [ 'emergency' => ['text' => 'red'], @@ -158,7 +158,7 @@ class ConsoleOutput * Construct the output object. * * Checks for a pretty console environment. Ansicon and ConEmu allows - * pretty consoles on windows, and is supported. + * pretty consoles on Windows, and is supported. * * @param string $stream The identifier of the stream to write output to. */ @@ -190,7 +190,7 @@ function_exists('posix_isatty') && * Outputs a single or multiple messages to stdout or stderr. If no parameters * are passed, outputs just a newline. * - * @param string|string[] $message A string or an array of strings to output + * @param array|string $message A string or an array of strings to output * @param int $newlines Number of newlines to append * @return int The number of bytes returned from writing to output. */ @@ -230,7 +230,7 @@ public function styleText(string $text): string /** * Replace tags with color codes. * - * @param array $matches An array of matches to replace. + * @param array $matches An array of matches to replace. * @return string */ protected function _replaceTags(array $matches): string @@ -312,7 +312,7 @@ public function setStyle(string $style, array $definition): void /** * Gets all the style definitions. * - * @return array + * @return array */ public function styles(): array { diff --git a/app/vendor/cakephp/cakephp/src/Console/Exception/MissingOptionException.php b/app/vendor/cakephp/cakephp/src/Console/Exception/MissingOptionException.php index 58f8a8ef..0d1cfe81 100644 --- a/app/vendor/cakephp/cakephp/src/Console/Exception/MissingOptionException.php +++ b/app/vendor/cakephp/cakephp/src/Console/Exception/MissingOptionException.php @@ -32,7 +32,7 @@ class MissingOptionException extends ConsoleException /** * The valid suggestions. * - * @var string[] + * @var array */ protected $suggestions = []; @@ -41,7 +41,7 @@ class MissingOptionException extends ConsoleException * * @param string $message The string message. * @param string $requested The requested value. - * @param string[] $suggestions The list of potential values that were valid. + * @param array $suggestions The list of potential values that were valid. * @param int|null $code The exception code if relevant. * @param \Throwable|null $previous the previous exception. */ @@ -87,14 +87,14 @@ public function getFullMessage(): string * Find the best match for requested in suggestions * * @param string $needle Unknown option name trying to be used. - * @param string[] $haystack Suggestions to look through. + * @param array $haystack Suggestions to look through. * @return string The best match */ protected function findClosestItem($needle, $haystack): ?string { $bestGuess = null; foreach ($haystack as $item) { - if (preg_match('/^' . $needle . '/', $item)) { + if (strpos($item, $needle) === 0) { return $item; } } diff --git a/app/vendor/cakephp/cakephp/src/Console/HelpFormatter.php b/app/vendor/cakephp/cakephp/src/Console/HelpFormatter.php index 275972b4..146b0bb9 100644 --- a/app/vendor/cakephp/cakephp/src/Console/HelpFormatter.php +++ b/app/vendor/cakephp/cakephp/src/Console/HelpFormatter.php @@ -118,7 +118,7 @@ public function text(int $width = 72): string } $options = $parser->options(); - if (!empty($options)) { + if ($options) { $max = $this->_getMaxLength($options) + 8; $out[] = 'Options:'; $out[] = ''; @@ -192,7 +192,7 @@ protected function _generateUsage(): string /** * Iterate over a collection and find the longest named thing. * - * @param array $collection The collection to find a max length of. + * @param array<\Cake\Console\ConsoleInputOption|\Cake\Console\ConsoleInputArgument|\Cake\Console\ConsoleInputSubcommand> $collection The collection to find a max length of. * @return int */ protected function _getMaxLength(array $collection): int @@ -209,7 +209,7 @@ protected function _getMaxLength(array $collection): int * Get the help as an XML string. * * @param bool $string Return the SimpleXml object or a string. Defaults to true. - * @return string|\SimpleXMLElement See $string + * @return \SimpleXMLElement|string See $string */ public function xml(bool $string = true) { diff --git a/app/vendor/cakephp/cakephp/src/Console/Helper.php b/app/vendor/cakephp/cakephp/src/Console/Helper.php index 50a49767..d9161b6a 100644 --- a/app/vendor/cakephp/cakephp/src/Console/Helper.php +++ b/app/vendor/cakephp/cakephp/src/Console/Helper.php @@ -32,7 +32,7 @@ abstract class Helper /** * Default config for this helper. * - * @var array + * @var array */ protected $_defaultConfig = []; @@ -47,7 +47,7 @@ abstract class Helper * Constructor. * * @param \Cake\Console\ConsoleIo $io The ConsoleIo instance to use. - * @param array $config The settings for this helper. + * @param array $config The settings for this helper. */ public function __construct(ConsoleIo $io, array $config = []) { diff --git a/app/vendor/cakephp/cakephp/src/Console/HelperRegistry.php b/app/vendor/cakephp/cakephp/src/Console/HelperRegistry.php index 900bbc31..30f312c1 100644 --- a/app/vendor/cakephp/cakephp/src/Console/HelperRegistry.php +++ b/app/vendor/cakephp/cakephp/src/Console/HelperRegistry.php @@ -52,7 +52,7 @@ public function setIo(ConsoleIo $io): void * Will prefer helpers defined in Command\Helper over those * defined in Shell\Helper. * - * Part of the template method for Cake\Core\ObjectRegistry::load() + * Part of the template method for {@link \Cake\Core\ObjectRegistry::load()}. * * @param string $class Partial classname to resolve. * @return string|null Either the correct class name or null. @@ -94,7 +94,7 @@ protected function _throwMissingClassError(string $class, ?string $plugin): void * * @param string $class The classname to create. * @param string $alias The alias of the helper. - * @param array $config An array of settings to use for the helper. + * @param array $config An array of settings to use for the helper. * @return \Cake\Console\Helper The constructed helper class. * @psalm-suppress MoreSpecificImplementedParamType */ diff --git a/app/vendor/cakephp/cakephp/src/Console/Shell.php b/app/vendor/cakephp/cakephp/src/Console/Shell.php index f196e36c..0fae3a50 100644 --- a/app/vendor/cakephp/cakephp/src/Console/Shell.php +++ b/app/vendor/cakephp/cakephp/src/Console/Shell.php @@ -143,7 +143,7 @@ class Shell /** * Contains the loaded tasks * - * @var array + * @var array */ public $taskNames = []; @@ -157,7 +157,7 @@ class Shell /** * Normalized map of tasks. * - * @var array + * @var array */ protected $_taskMap = []; @@ -394,9 +394,7 @@ public function dispatchShell(): int { [$args, $extra] = $this->parseDispatchArguments(func_get_args()); - if (!isset($extra['requested'])) { - $extra['requested'] = true; - } + $extra['requested'] = $extra['requested'] ?? true; /** @psalm-suppress DeprecatedClass */ $dispatcher = new ShellDispatcher($args, false); @@ -615,18 +613,14 @@ public function __get(string $name) */ public function param(string $name) { - if (!isset($this->params[$name])) { - return null; - } - - return $this->params[$name]; + return $this->params[$name] ?? null; } /** * Prompts the user for input, and returns it. * * @param string $prompt Prompt text. - * @param string|array|null $options Array or string of options. + * @param array|string|null $options Array or string of options. * @param string|null $default Default input value. * @return string|null Either the default value, or the user-provided input. * @link https://book.cakephp.org/4/en/console-and-shells.html#Shell::in @@ -654,7 +648,7 @@ public function in(string $prompt, $options = null, ?string $default = null): ?s * - `indent` Indent the text with the string provided. Defaults to null. * * @param string $text Text the text to format. - * @param int|array $options Array of options to use, or an integer to wrap the text to. + * @param array|int $options Array of options to use, or an integer to wrap the text to. * @return string Wrapped / indented text * @see \Cake\Utility\Text::wrap() * @link https://book.cakephp.org/4/en/console-and-shells.html#Shell::wrapText @@ -667,7 +661,7 @@ public function wrapText(string $text, $options = []): string /** * Output at the verbose level. * - * @param string|string[] $message A string or an array of strings to output + * @param array|string $message A string or an array of strings to output * @param int $newlines Number of newlines to append * @return int|null The number of bytes returned from writing to stdout. */ @@ -679,7 +673,7 @@ public function verbose($message, int $newlines = 1): ?int /** * Output at all levels. * - * @param string|string[] $message A string or an array of strings to output + * @param array|string $message A string or an array of strings to output * @param int $newlines Number of newlines to append * @return int|null The number of bytes returned from writing to stdout. */ @@ -699,7 +693,7 @@ public function quiet($message, int $newlines = 1): ?int * present in most shells. Using Shell::QUIET for a message means it will always display. * While using Shell::VERBOSE means it will only display when verbose output is toggled. * - * @param string|string[] $message A string or an array of strings to output + * @param array|string $message A string or an array of strings to output * @param int $newlines Number of newlines to append * @param int $level The message's output level, see above. * @return int|null The number of bytes returned from writing to stdout. @@ -714,7 +708,7 @@ public function out($message, int $newlines = 1, int $level = Shell::NORMAL): ?i * Outputs a single or multiple error messages to stderr. If no parameters * are passed outputs just a newline. * - * @param string|string[] $message A string or an array of strings to output + * @param array|string $message A string or an array of strings to output * @param int $newlines Number of newlines to append * @return int The number of bytes returned from writing to stderr. */ @@ -726,7 +720,7 @@ public function err($message, int $newlines = 1): int /** * Convenience method for out() that wraps message between tag * - * @param string|string[] $message A string or an array of strings to output + * @param array|string $message A string or an array of strings to output * @param int $newlines Number of newlines to append * @param int $level The message's output level, see above. * @return int|null The number of bytes returned from writing to stdout. @@ -740,7 +734,7 @@ public function info($message, int $newlines = 1, int $level = Shell::NORMAL): ? /** * Convenience method for err() that wraps message between tag * - * @param string|string[] $message A string or an array of strings to output + * @param array|string $message A string or an array of strings to output * @param int $newlines Number of newlines to append * @return int The number of bytes returned from writing to stderr. * @see https://book.cakephp.org/4/en/console-and-shells.html#Shell::err @@ -753,7 +747,7 @@ public function warn($message, int $newlines = 1): int /** * Convenience method for out() that wraps message between tag * - * @param string|string[] $message A string or an array of strings to output + * @param array|string $message A string or an array of strings to output * @param int $newlines Number of newlines to append * @param int $level The message's output level, see above. * @return int|null The number of bytes returned from writing to stdout. @@ -906,12 +900,12 @@ public function shortPath(string $file): string * object has not already been loaded, it will be loaded and constructed. * * @param string $name The name of the helper to render - * @param array $settings Configuration data for the helper. + * @param array $config Configuration data for the helper. * @return \Cake\Console\Helper The created helper instance. */ - public function helper(string $name, array $settings = []): Helper + public function helper(string $name, array $config = []): Helper { - return $this->_io->helper($name, $settings); + return $this->_io->helper($name, $config); } /** @@ -931,7 +925,7 @@ protected function _stop(int $status = self::CODE_SUCCESS): void * Returns an array that can be used to describe the internal state of this * object. * - * @return array + * @return array */ public function __debugInfo(): array { diff --git a/app/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php b/app/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php index 482b4800..79f4fced 100644 --- a/app/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php +++ b/app/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php @@ -44,7 +44,7 @@ class ShellDispatcher /** * List of connected aliases. * - * @var array + * @var array */ protected static $_aliases = []; @@ -203,7 +203,7 @@ public function dispatch(array $extra = []): int * Built-in extra parameter is : * * - `requested` : if used, will prevent the Shell welcome message to be displayed - * @return bool|int|null + * @return int|bool|null * @throws \Cake\Console\Exception\MissingShellMethodException */ protected function _dispatch(array $extra = []) @@ -279,7 +279,6 @@ public function addShortPluginAliases(): array $other = static::alias($shell); if ($other) { - $other = $aliases[$shell]; if ($other !== $plugin) { Log::write( 'debug', diff --git a/app/vendor/cakephp/cakephp/src/Console/TaskRegistry.php b/app/vendor/cakephp/cakephp/src/Console/TaskRegistry.php index e4863e7b..9368a3a2 100644 --- a/app/vendor/cakephp/cakephp/src/Console/TaskRegistry.php +++ b/app/vendor/cakephp/cakephp/src/Console/TaskRegistry.php @@ -48,7 +48,7 @@ public function __construct(Shell $shell) /** * Resolve a task classname. * - * Part of the template method for Cake\Core\ObjectRegistry::load() + * Part of the template method for {@link \Cake\Core\ObjectRegistry::load()}. * * @param string $class Partial classname to resolve. * @return string|null Either the correct class name or null. @@ -66,7 +66,7 @@ protected function _resolveClassName(string $class): ?string * and Cake\Core\ObjectRegistry::unload() * * @param string $class The classname that is missing. - * @param string $plugin The plugin the task is missing in. + * @param string|null $plugin The plugin the task is missing in. * @return void * @throws \Cake\Console\Exception\MissingTaskException */ @@ -85,7 +85,7 @@ protected function _throwMissingClassError(string $class, ?string $plugin): void * * @param string $class The classname to create. * @param string $alias The alias of the task. - * @param array $config An array of settings to use for the task. + * @param array $config An array of settings to use for the task. * @return \Cake\Console\Shell The constructed task class. * @psalm-suppress MoreSpecificImplementedParamType */ diff --git a/app/vendor/cakephp/cakephp/src/Controller/Component.php b/app/vendor/cakephp/cakephp/src/Controller/Component.php index 54362df6..52540c03 100644 --- a/app/vendor/cakephp/cakephp/src/Controller/Component.php +++ b/app/vendor/cakephp/cakephp/src/Controller/Component.php @@ -37,13 +37,13 @@ * cycle. The available callbacks are: * * - `beforeFilter(EventInterface $event)` - * Called before the controller's beforeFilter method by default. + * Called before Controller::beforeFilter() method by default. * - `startup(EventInterface $event)` - * Called after the controller's beforeFilter method, and before the + * Called after Controller::beforeFilter() method, and before the * controller action is called. * - `beforeRender(EventInterface $event)` - * Called before the Controller beforeRender, and before the view class is loaded. - * - `shutdown(EventInterface $event)` + * Called before Controller::beforeRender(), and before the view class is loaded. + * - `afterFilter(EventInterface $event)` * Called after the action is complete and the view has been rendered but * before Controller::afterFilter(). * - `beforeRedirect(EventInterface $event $url, Response $response)` @@ -82,14 +82,14 @@ class Component implements EventListenerInterface * * These are merged with user-provided config when the component is used. * - * @var array + * @var array */ protected $_defaultConfig = []; /** * A component lookup table used to lazy load component objects. * - * @var array + * @var array */ protected $_componentMap = []; @@ -98,7 +98,7 @@ class Component implements EventListenerInterface * * @param \Cake\Controller\ComponentRegistry $registry A component registry * this component can use to lazy load its components. - * @param array $config Array of configuration settings. + * @param array $config Array of configuration settings. */ public function __construct(ComponentRegistry $registry, array $config = []) { @@ -128,7 +128,7 @@ public function getController(): Controller * Implement this method to avoid having to overwrite * the constructor and call parent. * - * @param array $config The configuration settings provided to this component. + * @param array $config The configuration settings provided to this component. * @return void */ public function initialize(array $config): void @@ -147,11 +147,8 @@ public function __get(string $name) $config = (array)$this->_componentMap[$name]['config'] + ['enabled' => false]; $this->{$name} = $this->_registry->load($this->_componentMap[$name]['class'], $config); } - if (!isset($this->{$name})) { - return null; - } - return $this->{$name}; + return $this->{$name} ?? null; } /** @@ -164,7 +161,7 @@ public function __get(string $name) * Override this method if you need to add non-conventional event listeners. * Or if you want components to listen to non-standard events. * - * @return array + * @return array */ public function implementedEvents(): array { @@ -173,7 +170,7 @@ public function implementedEvents(): array 'Controller.startup' => 'startup', 'Controller.beforeRender' => 'beforeRender', 'Controller.beforeRedirect' => 'beforeRedirect', - 'Controller.shutdown' => 'shutdown', + 'Controller.shutdown' => 'afterFilter', ]; $events = []; foreach ($eventMap as $event => $method) { @@ -182,6 +179,14 @@ public function implementedEvents(): array } } + if (!isset($events['Controller.shutdown']) && method_exists($this, 'shutdown')) { + deprecationWarning( + '`Controller.shutdown` event callback is now `afterFilter()` instead of `shutdown()`.', + 0 + ); + $events[$event] = 'shutdown'; + } + return $events; } @@ -189,7 +194,7 @@ public function implementedEvents(): array * Returns an array that can be used to describe the internal state of this * object. * - * @return array + * @return array */ public function __debugInfo(): array { diff --git a/app/vendor/cakephp/cakephp/src/Controller/Component/AuthComponent.php b/app/vendor/cakephp/cakephp/src/Controller/Component/AuthComponent.php index a9d859b2..d9b0a59e 100644 --- a/app/vendor/cakephp/cakephp/src/Controller/Component/AuthComponent.php +++ b/app/vendor/cakephp/cakephp/src/Controller/Component/AuthComponent.php @@ -79,7 +79,7 @@ class AuthComponent extends Component implements EventDispatcherInterface * ``` * * Using the class name without 'Authenticate' as the key, you can pass in an - * array of config for each authentication object. Additionally you can define + * array of config for each authentication object. Additionally, you can define * config that should be set to all authentications objects using the 'all' key: * * ``` @@ -156,7 +156,7 @@ class AuthComponent extends Component implements EventDispatcherInterface * Defaults to 'Controller.startup'. You can set it to 'Controller.initialize' * if you want the check to be done before controller's beforeFilter() is run. * - * @var array + * @var array */ protected $_defaultConfig = [ 'authenticate' => null, @@ -181,14 +181,14 @@ class AuthComponent extends Component implements EventDispatcherInterface /** * Objects that will be used for authentication checks. * - * @var \Cake\Auth\BaseAuthenticate[] + * @var array<\Cake\Auth\BaseAuthenticate> */ protected $_authenticateObjects = []; /** * Objects that will be used for authorization checks. * - * @var \Cake\Auth\BaseAuthorize[] + * @var array<\Cake\Auth\BaseAuthorize> */ protected $_authorizeObjects = []; @@ -202,7 +202,7 @@ class AuthComponent extends Component implements EventDispatcherInterface /** * Controller actions for which user validation is not required. * - * @var string[] + * @var array * @see \Cake\Controller\Component\AuthComponent::allow() */ public $allowedActions = []; @@ -227,7 +227,7 @@ class AuthComponent extends Component implements EventDispatcherInterface /** * Initialize properties. * - * @param array $config The config data. + * @param array $config The config data. * @return void */ public function initialize(array $config): void @@ -308,7 +308,7 @@ public function authCheck(EventInterface $event): ?Response /** * Events supported by this component. * - * @return array + * @return array */ public function implementedEvents(): array { @@ -474,11 +474,11 @@ protected function _setDefaults(): void /** * Check if the provided user is authorized for the request. * - * Uses the configured Authorization adapters to check whether or not a user is authorized. + * Uses the configured Authorization adapters to check whether a user is authorized. * Each adapter will be checked in sequence, if any of them return true, then the user will * be authorized for the request. * - * @param array|\ArrayAccess|null $user The user to check the authorization of. + * @param \ArrayAccess|array|null $user The user to check the authorization of. * If empty the user fetched from storage will be used. * @param \Cake\Http\ServerRequest|null $request The request to authenticate for. * If empty, the current request will be used. @@ -578,7 +578,7 @@ public function getAuthorize(string $alias): ?BaseAuthorize * $this->Auth->allow(); * ``` * - * @param string|string[]|null $actions Controller action name or array of actions + * @param array|string|null $actions Controller action name or array of actions * @return void * @link https://book.cakephp.org/4/en/controllers/components/authentication.html#making-actions-public */ @@ -608,7 +608,7 @@ public function allow($actions = null): void * ``` * to remove all items from the allowed list * - * @param string|string[]|null $actions Controller action name or array of actions + * @param array|string|null $actions Controller action name or array of actions * @return void * @see \Cake\Controller\Component\AuthComponent::allow() * @link https://book.cakephp.org/4/en/controllers/components/authentication.html#making-actions-require-authorization @@ -635,7 +635,7 @@ public function deny($actions = null): void * The storage class is configured using `storage` config key or passing * instance to AuthComponent::storage(). * - * @param array|\ArrayAccess $user User data. + * @param \ArrayAccess|array $user User data. * @return void * @link https://book.cakephp.org/4/en/controllers/components/authentication.html#identifying-users-and-logging-them-in */ @@ -738,7 +738,7 @@ protected function _getUser(): bool * `loginRedirect`, the `loginRedirect` value is returned. * - If there is no session and no `loginRedirect`, / is returned. * - * @param string|array|null $url Optional URL to write as the login redirect URL. + * @param array|string|null $url Optional URL to write as the login redirect URL. * @return string Redirect URL */ public function redirectUrl($url = null): string @@ -807,7 +807,7 @@ public function identify() /** * Loads the configured authentication objects. * - * @return array|null The loaded authorization objects, or null on empty authenticate value. + * @return array|null The loaded authorization objects, or null on empty authenticate value. * @throws \Cake\Core\Exception\CakeException */ public function constructAuthenticate(): ?array diff --git a/app/vendor/cakephp/cakephp/src/Controller/Component/FlashComponent.php b/app/vendor/cakephp/cakephp/src/Controller/Component/FlashComponent.php index 93b120bf..73124a51 100644 --- a/app/vendor/cakephp/cakephp/src/Controller/Component/FlashComponent.php +++ b/app/vendor/cakephp/cakephp/src/Controller/Component/FlashComponent.php @@ -28,6 +28,8 @@ * FlashHelper. * * @method void success(string $message, array $options = []) Set a message using "success" element + * @method void info(string $message, array $options = []) Set a message using "info" element + * @method void warning(string $message, array $options = []) Set a message using "warning" element * @method void error(string $message, array $options = []) Set a message using "error" element */ class FlashComponent extends Component @@ -35,7 +37,7 @@ class FlashComponent extends Component /** * Default configuration * - * @var array + * @var array */ protected $_defaultConfig = [ 'key' => 'flash', @@ -60,10 +62,10 @@ class FlashComponent extends Component * - `clear` A bool stating if the current stack should be cleared to start a new one * - `escape` Set to false to allow templates to print out HTML content * - * @param string|\Throwable $message Message to be flashed. If an instance + * @param \Throwable|string $message Message to be flashed. If an instance * of \Throwable the throwable message will be used and code will be set * in params. - * @param array $options An array of options + * @param array $options An array of options * @return void */ public function set($message, array $options = []): void @@ -88,7 +90,7 @@ protected function flash(): FlashMessage /** * Proxy method to FlashMessage instance. * - * @param string|array $key The key to set, or a complete array of configs. + * @param array|string $key The key to set, or a complete array of configs. * @param mixed|null $value The value to set. * @param bool $merge Whether to recursively merge or overwrite existing config, defaults to true. * @return $this @@ -128,7 +130,7 @@ public function getConfigOrFail(string $key) /** * Proxy method to FlashMessage instance. * - * @param string|array $key The key to set, or a complete array of configs. + * @param array|string $key The key to set, or a complete array of configs. * @param mixed|null $value The value to set. * @return $this */ diff --git a/app/vendor/cakephp/cakephp/src/Controller/Component/FormProtectionComponent.php b/app/vendor/cakephp/cakephp/src/Controller/Component/FormProtectionComponent.php index c2861b8d..947403dc 100644 --- a/app/vendor/cakephp/cakephp/src/Controller/Component/FormProtectionComponent.php +++ b/app/vendor/cakephp/cakephp/src/Controller/Component/FormProtectionComponent.php @@ -58,7 +58,7 @@ class FormProtectionComponent extends Component * failure. Must be a valid Closure. Unset by default in which case * exception is thrown on validation failure. * - * @var array + * @var array */ protected $_defaultConfig = [ 'validate' => true, @@ -118,7 +118,7 @@ public function startup(EventInterface $event): ?Response /** * Events supported by this component. * - * @return array + * @return array */ public function implementedEvents(): array { diff --git a/app/vendor/cakephp/cakephp/src/Controller/Component/PaginatorComponent.php b/app/vendor/cakephp/cakephp/src/Controller/Component/PaginatorComponent.php index 8391cdb1..715ed486 100644 --- a/app/vendor/cakephp/cakephp/src/Controller/Component/PaginatorComponent.php +++ b/app/vendor/cakephp/cakephp/src/Controller/Component/PaginatorComponent.php @@ -23,6 +23,7 @@ use Cake\Datasource\ResultSetInterface; use Cake\Http\Exception\NotFoundException; use InvalidArgumentException; +use UnexpectedValueException; /** * This component is used to handle automatic model data pagination. The primary way to use this @@ -37,28 +38,6 @@ */ class PaginatorComponent extends Component { - /** - * Default pagination settings. - * - * When calling paginate() these settings will be merged with the configuration - * you provide. - * - * - `maxLimit` - The maximum limit users can choose to view. Defaults to 100 - * - `limit` - The initial number of items per page. Defaults to 20. - * - `page` - The starting page, defaults to 1. - * - `allowedParameters` - A list of parameters users are allowed to set using request - * parameters. Modifying this list will allow users to have more influence - * over pagination, be careful with what you permit. - * - * @var array - */ - protected $_defaultConfig = [ - 'page' => 1, - 'limit' => 20, - 'maxLimit' => 100, - 'allowedParameters' => ['limit', 'sort', 'page', 'direction'], - ]; - /** * Datasource paginator instance. * @@ -71,6 +50,10 @@ class PaginatorComponent extends Component */ public function __construct(ComponentRegistry $registry, array $config = []) { + if (!empty($this->_defaultConfig)) { + throw new UnexpectedValueException('Default configuration must be set using a custom Paginator class.'); + } + if (isset($config['paginator'])) { if (!$config['paginator'] instanceof Paginator) { throw new InvalidArgumentException('Paginator must be an instance of ' . Paginator::class); @@ -87,7 +70,7 @@ public function __construct(ComponentRegistry $registry, array $config = []) /** * Events supported by this component. * - * @return array + * @return array */ public function implementedEvents(): array { @@ -188,7 +171,7 @@ public function implementedEvents(): array * ``` * * @param \Cake\Datasource\RepositoryInterface|\Cake\Datasource\QueryInterface $object Table or query to paginate. - * @param array $settings The settings/configuration used for pagination. + * @param array $settings The settings/configuration used for pagination. * @return \Cake\Datasource\ResultSetInterface Query results * @throws \Cake\Http\Exception\NotFoundException */ @@ -226,8 +209,8 @@ public function paginate(object $object, array $settings = []): ResultSetInterfa * * @param string $alias Model alias being paginated, if the general settings has a key with this value * that key's settings will be used for pagination instead of the general ones. - * @param array $settings The settings to merge with the request data. - * @return array Array of merged options. + * @param array $settings The settings to merge with the request data. + * @return array Array of merged options. */ public function mergeOptions(string $alias, array $settings): array { @@ -279,7 +262,7 @@ protected function _setPagingParams(): void /** * Proxy setting config options to Paginator. * - * @param string|array $key The key to set, or a complete array of configs. + * @param array|string $key The key to set, or a complete array of configs. * @param mixed|null $value The value to set. * @param bool $merge Whether to recursively merge or overwrite existing config, defaults to true. * @return $this @@ -306,7 +289,7 @@ public function getConfig(?string $key = null, $default = null) /** * Proxy setting config options to Paginator. * - * @param string|array $key The key to set, or a complete array of configs. + * @param array|string $key The key to set, or a complete array of configs. * @param mixed|null $value The value to set. * @return $this */ diff --git a/app/vendor/cakephp/cakephp/src/Controller/Component/RequestHandlerComponent.php b/app/vendor/cakephp/cakephp/src/Controller/Component/RequestHandlerComponent.php index fa2223c7..f18c3cc6 100644 --- a/app/vendor/cakephp/cakephp/src/Controller/Component/RequestHandlerComponent.php +++ b/app/vendor/cakephp/cakephp/src/Controller/Component/RequestHandlerComponent.php @@ -65,7 +65,7 @@ class RequestHandlerComponent extends Component * - `viewClassMap` - Mapping between type and view classes. If undefined * JSON, XML, and AJAX will be mapped. Defining any types will omit the defaults. * - * @var array + * @var array */ protected $_defaultConfig = [ 'checkHttpCache' => true, @@ -76,7 +76,7 @@ class RequestHandlerComponent extends Component * Constructor. Parses the accepted content types accepted by the client using HTTP_ACCEPT * * @param \Cake\Controller\ComponentRegistry $registry ComponentRegistry object. - * @param array $config Array of config. + * @param array $config Array of config. */ public function __construct(ComponentRegistry $registry, array $config = []) { @@ -93,7 +93,7 @@ public function __construct(ComponentRegistry $registry, array $config = []) /** * Events supported by this component. * - * @return array + * @return array */ public function implementedEvents(): array { @@ -183,12 +183,12 @@ public function startup(EventInterface $event): void * - If Router::extensions() is enabled, the layout and template type are * switched based on the parsed extension or `Accept` header. For example, * if `controller/action.xml` is requested, the view path becomes - * `templates/Controller/xml/action.php`. Also if `controller/action` is + * `templates/Controller/xml/action.php`. Also, if `controller/action` is * requested with `Accept: application/xml` in the headers the view * path will become `templates/Controller/xml/action.php`. Layout and template - * types will only switch to mime-types recognized by Cake\Http\Response. + * types will only switch to mime-types recognized by \Cake\Http\Response. * If you need to declare additional mime-types, you can do so using - * Cake\Http\Response::setTypeMap() in your controller's beforeFilter() method. + * {@link \Cake\Http\Response::setTypeMap()} in your controller's beforeFilter() method. * - If a helper with the same name as the extension exists, it is added to * the controller. * - If the extension is of a type that RequestHandler understands, it will @@ -230,7 +230,7 @@ public function beforeRender(EventInterface $event): void /** * Determines which content types the client accepts. Acceptance is based on * the file extension parsed by the Router (if present), and by the HTTP_ACCEPT - * header. Unlike Cake\Http\ServerRequest::accepts() this method deals entirely with mapped content types. + * header. Unlike {@link \Cake\Http\ServerRequest::accepts()} this method deals entirely with mapped content types. * * Usage: * @@ -246,9 +246,9 @@ public function beforeRender(EventInterface $event): void * * Returns true if the client accepts XML. * - * @param string|array|null $type Can be null (or no parameter), a string type name, or an + * @param array|string|null $type Can be null (or no parameter), a string type name, or an * array of types - * @return mixed If null or no parameter is passed, returns an array of content + * @return array|bool|string|null If null or no parameter is passed, returns an array of content * types the client accepts. If a string is passed, returns true * if the client accepts it. If an array is passed, returns true * if the client accepts one or more elements in the array. @@ -284,7 +284,7 @@ public function accepts($type = null) /** * Determines the content type of the data the client has sent (i.e. in a POST request) * - * @param string|array|null $type Can be null (or no parameter), a string type name, or an array of types + * @param array|string|null $type Can be null (or no parameter), a string type name, or an array of types * @return mixed If a single type is supplied a boolean will be returned. If no type is provided * The mapped value of CONTENT_TYPE will be returned. If an array is supplied the first type * in the request content type will be returned. @@ -317,9 +317,11 @@ public function requestedWith($type = null) return $controller->getResponse()->mapType($contentType); } - if (is_string($type)) { - return $type === $controller->getResponse()->mapType($contentType); + if (!is_string($type)) { + return null; } + + return $type === $controller->getResponse()->mapType($contentType); } /** @@ -330,7 +332,7 @@ public function requestedWith($type = null) * if provided, and secondarily by the list of content-types provided in * HTTP_ACCEPT. * - * @param string|array|null $type An optional array of 'friendly' content-type names, i.e. + * @param array|string|null $type An optional array of 'friendly' content-type names, i.e. * 'html', 'xml', 'js', etc. * @return string|bool|null If $type is null or not provided, the first content-type in the * list, based on preference, is returned. If a single type is provided @@ -394,7 +396,7 @@ public function prefers($type = null) * * @param \Cake\Controller\Controller $controller A reference to a controller object * @param string $type Type of response to send (e.g: 'ajax') - * @param array $options Array of options to use + * @param array $options Array of options to use * @return void * @see \Cake\Controller\Component\RequestHandlerComponent::respondAs() */ @@ -444,11 +446,11 @@ public function renderAs(Controller $controller, string $type, array $options = /** * Sets the response header based on type map index name. This wraps several methods - * available on Cake\Http\Response. It also allows you to use Content-Type aliases. + * available on {@link \Cake\Http\Response}. It also allows you to use Content-Type aliases. * * @param string $type Friendly type name, i.e. 'html' or 'xml', or a full content-type, * like 'application/x-shockwave'. - * @param array $options If $type is a friendly type name that is associated with + * @param array $options If $type is a friendly type name that is associated with * more than one type of content, $index is used to select which content-type to use. * @return bool Returns false if the friendly type name given in $type does * not exist in the type map, or if the Content-type header has @@ -467,9 +469,7 @@ public function respondAs($type, array $options = []): bool $cType = $response->getMimeType($type); } if (is_array($cType)) { - if (isset($cType[$options['index']])) { - $cType = $cType[$options['index']]; - } + $cType = $cType[$options['index']] ?? $cType; if ($this->prefers($cType)) { $cType = $this->prefers($cType); @@ -482,6 +482,7 @@ public function respondAs($type, array $options = []): bool return false; } + /** @psalm-suppress PossiblyInvalidArgument */ $response = $response->withType($cType); if (!empty($options['charset'])) { @@ -498,8 +499,8 @@ public function respondAs($type, array $options = []): bool /** * Maps a content type alias back to its mime-type(s) * - * @param string|array $alias String alias to convert back into a content type. Or an array of aliases to map. - * @return string|array|null Null on an undefined alias. String value of the mapped alias type. If an + * @param array|string $alias String alias to convert back into a content type. Or an array of aliases to map. + * @return array|string|null Null on an undefined alias. String value of the mapped alias type. If an * alias maps to more than one content type, the first one will be returned. If an array is provided * for $alias, an array of mapped types will be returned. */ diff --git a/app/vendor/cakephp/cakephp/src/Controller/Component/SecurityComponent.php b/app/vendor/cakephp/cakephp/src/Controller/Component/SecurityComponent.php index b8f44c14..4043b3f3 100644 --- a/app/vendor/cakephp/cakephp/src/Controller/Component/SecurityComponent.php +++ b/app/vendor/cakephp/cakephp/src/Controller/Component/SecurityComponent.php @@ -64,7 +64,7 @@ class SecurityComponent extends Component * - `validatePost` - Whether to validate POST data. Set to false to disable * for data coming from 3rd party services, etc. * - * @var array + * @var array */ protected $_defaultConfig = [ 'blackHoleCallback' => null, @@ -127,7 +127,7 @@ public function startup(EventInterface $event): ?Response /** * Events supported by this component. * - * @return array + * @return array */ public function implementedEvents(): array { @@ -139,7 +139,7 @@ public function implementedEvents(): array /** * Sets the actions that require a request that is SSL-secured, or empty for all actions * - * @param string|string[]|null $actions Actions list + * @param array|string|null $actions Actions list * @return void */ public function requireSecure($actions = null): void @@ -285,7 +285,7 @@ protected function _validToken(Controller $controller): string * Return hash parts for the Token generation * * @param \Cake\Controller\Controller $controller Instantiating controller - * @return string[] + * @return array */ protected function _hashParts(Controller $controller): array { @@ -409,7 +409,7 @@ protected function _sortedUnlocked(array $data): string * Create a message for humans to understand why Security token is not matching * * @param \Cake\Controller\Controller $controller Instantiating controller - * @param array $hashParts Elements used to generate the Token hash + * @param array $hashParts Elements used to generate the Token hash * @return string Message explaining why the tokens are not matching */ protected function _debugPostTokenNotMatching(Controller $controller, array $hashParts): string @@ -463,7 +463,7 @@ protected function _debugPostTokenNotMatching(Controller $controller, array $has * @param string $stringKeyMessage Message string if tampered found in * data fields indexed by string (protected). * @param string $missingMessage Message string if missing field - * @return string[] Messages + * @return array Messages */ protected function _debugCheckFields( array $dataFields, @@ -528,7 +528,7 @@ protected function _callback(Controller $controller, string $method, array $para * @param string $intKeyMessage Message string if unexpected found in data fields indexed by int (not protected) * @param string $stringKeyMessage Message string if tampered found in * data fields indexed by string (protected) - * @return string[] Error messages + * @return array Error messages */ protected function _matchExistingFields( array $dataFields, diff --git a/app/vendor/cakephp/cakephp/src/Controller/ComponentRegistry.php b/app/vendor/cakephp/cakephp/src/Controller/ComponentRegistry.php index 3e414254..28823051 100644 --- a/app/vendor/cakephp/cakephp/src/Controller/ComponentRegistry.php +++ b/app/vendor/cakephp/cakephp/src/Controller/ComponentRegistry.php @@ -84,7 +84,7 @@ public function setController(Controller $controller) /** * Resolve a component classname. * - * Part of the template method for Cake\Core\ObjectRegistry::load() + * Part of the template method for {@link \Cake\Core\ObjectRegistry::load()}. * * @param string $class Partial classname to resolve. * @return string|null Either the correct class name or null. @@ -98,8 +98,8 @@ protected function _resolveClassName(string $class): ?string /** * Throws an exception when a component is missing. * - * Part of the template method for Cake\Core\ObjectRegistry::load() - * and Cake\Core\ObjectRegistry::unload() + * Part of the template method for {@link \Cake\Core\ObjectRegistry::load()} + * and {@link \Cake\Core\ObjectRegistry::unload()} * * @param string $class The classname that is missing. * @param string|null $plugin The plugin the component is missing in. @@ -117,12 +117,12 @@ protected function _throwMissingClassError(string $class, ?string $plugin): void /** * Create the component instance. * - * Part of the template method for Cake\Core\ObjectRegistry::load() + * Part of the template method for {@link \Cake\Core\ObjectRegistry::load()} * Enabled components will be registered with the event manager. * * @param string $class The classname to create. * @param string $alias The alias of the component. - * @param array $config An array of config to use for the component. + * @param array $config An array of config to use for the component. * @return \Cake\Controller\Component The constructed component class. * @psalm-suppress MoreSpecificImplementedParamType * @psalm-param class-string $class diff --git a/app/vendor/cakephp/cakephp/src/Controller/Controller.php b/app/vendor/cakephp/cakephp/src/Controller/Controller.php index 240da2ba..a3300fbd 100644 --- a/app/vendor/cakephp/cakephp/src/Controller/Controller.php +++ b/app/vendor/cakephp/cakephp/src/Controller/Controller.php @@ -57,10 +57,10 @@ * possibly a redirection to another URL. In either case `$this->getResponse()` * allows you to manipulate all aspects of the response. * - * Controllers are created by `ActionDispatcher` based on request parameters and + * Controllers are created based on request parameters and * routing. By default controllers and actions use conventional names. * For example `/posts/index` maps to `PostsController::index()`. You can re-map - * URLs using Router::connect() or RouterBuilder::connect(). + * URLs using Router::connect() or RouteBuilder::connect(). * * ### Life cycle callbacks * @@ -121,13 +121,6 @@ class Controller implements EventListenerInterface, EventDispatcherInterface */ protected $response; - /** - * The class name to use for creating the response object. - * - * @var string - */ - protected $_responseClass = Response::class; - /** * Settings for pagination. * @@ -161,6 +154,14 @@ class Controller implements EventListenerInterface, EventDispatcherInterface */ protected $plugin; + /** + * Middlewares list. + * + * @var array + * @psalm-var array + */ + protected $middlewares = []; + /** * Constructor. * @@ -183,9 +184,7 @@ public function __construct( ) { if ($name !== null) { $this->name = $name; - } - - if ($this->name === null && $request && $request->getParam('controller')) { + } elseif ($this->name === null && $request) { $this->name = $request->getParam('controller'); } @@ -202,9 +201,18 @@ public function __construct( } $this->modelFactory('Table', [$this->getTableLocator(), 'get']); - $plugin = $this->request->getParam('plugin'); - $modelClass = ($plugin ? $plugin . '.' : '') . $this->name; - $this->_setModelClass($modelClass); + + if ($this->defaultTable !== null) { + $this->modelClass = $this->defaultTable; + } + + if ($this->modelClass === null) { + $plugin = $this->request->getParam('plugin'); + $modelClass = ($plugin ? $plugin . '.' : '') . $this->name; + $this->_setModelClass($modelClass); + + $this->defaultTable = $modelClass; + } if ($components !== null) { $this->components($components); @@ -274,10 +282,10 @@ public function components(?ComponentRegistry $components = null): ComponentRegi * $this->loadComponent('Authentication.Authentication'); * ``` * - * Will result in a `Toolbar` property being set. + * Will result in a `Authentication` property being set. * * @param string $name The name of the component to load. - * @param array $config The config for the component. + * @param array $config The config for the component. * @return \Cake\Controller\Component * @throws \Exception */ @@ -544,11 +552,64 @@ public function invokeAction(Closure $action, array $args): void } } + /** + * Register middleware for the controller. + * + * @param \Psr\Http\Server\MiddlewareInterface|\Closure|string $middleware Middleware. + * @param array $options Valid options: + * - `only`: (array|string) Only run the middleware for specified actions. + * - `except`: (array|string) Run the middleware for all actions except the specified ones. + * @return void + * @since 4.3.0 + * @psalm-param array{only?: array|string, except?: array|string} $options + */ + public function middleware($middleware, array $options = []) + { + $this->middlewares[] = [ + 'middleware' => $middleware, + 'options' => $options, + ]; + } + + /** + * Get middleware to be applied for this controller. + * + * @return array + * @since 4.3.0 + */ + public function getMiddleware(): array + { + $matching = []; + $action = $this->request->getParam('action'); + + foreach ($this->middlewares as $middleware) { + $options = $middleware['options']; + if (!empty($options['only'])) { + if (in_array($action, (array)$options['only'], true)) { + $matching[] = $middleware['middleware']; + } + + continue; + } + + if ( + !empty($options['except']) && + in_array($action, (array)$options['except'], true) + ) { + continue; + } + + $matching[] = $middleware['middleware']; + } + + return $matching; + } + /** * Returns a list of all events that will fire in the controller during its lifecycle. * You can override this function to add your own listener callbacks * - * @return array + * @return array */ public function implementedEvents(): array { @@ -606,7 +667,7 @@ public function shutdownProcess(): ?ResponseInterface /** * Redirects to given $url, after turning off $this->autoRender. * - * @param string|array|\Psr\Http\Message\UriInterface $url A string, array-based URL or UriInterface instance. + * @param \Psr\Http\Message\UriInterface|array|string $url A string, array-based URL or UriInterface instance. * @param int $status HTTP status code. Defaults to `302`. * @return \Cake\Http\Response|null * @link https://book.cakephp.org/4/en/controllers.html#Controller::redirect @@ -653,6 +714,10 @@ public function redirect($url, int $status = 302): ?Response */ public function setAction(string $action, ...$args) { + deprecationWarning( + 'Controller::setAction() is deprecated. Either refactor your code to use `redirect()`, ' . + 'or call the other action as a method.' + ); $this->setRequest($this->request->withParam('action', $action)); return $this->$action(...$args); @@ -724,7 +789,7 @@ protected function _templatePath(): string /** * Returns the referring URL for this request. * - * @param string|array|null $default Default URL to use if HTTP_REFERER cannot be read from headers + * @param array|string|null $default Default URL to use if HTTP_REFERER cannot be read from headers * @param bool $local If false, do not restrict referring URLs to local server. * Careful with trusting external sources. * @return string Referring URL @@ -758,9 +823,9 @@ public function referer($default = '/', bool $local = true): string * * This method will also make the PaginatorHelper available in the view. * - * @param \Cake\ORM\Table|string|\Cake\ORM\Query|null $object Table to paginate + * @param \Cake\ORM\Table|\Cake\ORM\Query|string|null $object Table to paginate * (e.g: Table instance, 'TableName' or a Query object) - * @param array $settings The settings/configuration used for pagination. + * @param array $settings The settings/configuration used for pagination. * @return \Cake\ORM\ResultSet|\Cake\Datasource\ResultSetInterface Query results * @link https://book.cakephp.org/4/en/controllers.html#paginating-a-model * @throws \RuntimeException When no compatible table object can be found. @@ -799,7 +864,7 @@ public function paginate($object = null, array $settings = []) * and allows all public methods on all subclasses of this class. * * @param string $action The action to check. - * @return bool Whether or not the method is accessible from a URL. + * @return bool Whether the method is accessible from a URL. * @throws \ReflectionException */ public function isAction(string $action): bool @@ -851,7 +916,7 @@ public function beforeRender(EventInterface $event) * using controller's response instance. * * @param \Cake\Event\EventInterface $event An Event instance - * @param string|array $url A string or array-based URL pointing to another location within the app, + * @param array|string $url A string or array-based URL pointing to another location within the app, * or an absolute URL * @param \Cake\Http\Response $response The response object. * @return \Cake\Http\Response|null|void diff --git a/app/vendor/cakephp/cakephp/src/Controller/ControllerFactory.php b/app/vendor/cakephp/cakephp/src/Controller/ControllerFactory.php index b877977e..65a09ca9 100644 --- a/app/vendor/cakephp/cakephp/src/Controller/ControllerFactory.php +++ b/app/vendor/cakephp/cakephp/src/Controller/ControllerFactory.php @@ -16,15 +16,19 @@ */ namespace Cake\Controller; +use Cake\Controller\Exception\InvalidParameterException; use Cake\Core\App; use Cake\Core\ContainerInterface; use Cake\Http\ControllerFactoryInterface; use Cake\Http\Exception\MissingControllerException; +use Cake\Http\MiddlewareQueue; +use Cake\Http\Runner; use Cake\Http\ServerRequest; use Cake\Utility\Inflector; -use InvalidArgumentException; +use Closure; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; +use Psr\Http\Server\RequestHandlerInterface; use ReflectionClass; use ReflectionFunction; use ReflectionNamedType; @@ -34,13 +38,18 @@ * * @implements \Cake\Http\ControllerFactoryInterface<\Cake\Controller\Controller> */ -class ControllerFactory implements ControllerFactoryInterface +class ControllerFactory implements ControllerFactoryInterface, RequestHandlerInterface { /** * @var \Cake\Core\ContainerInterface */ protected $container; + /** + * @var \Cake\Controller\Controller + */ + protected $controller; + /** * Constructor * @@ -85,75 +94,189 @@ public function create(ServerRequestInterface $request): Controller /** * Invoke a controller's action and wrapping methods. * - * @param mixed $controller The controller to invoke. + * @param \Cake\Controller\Controller $controller The controller to invoke. * @return \Psr\Http\Message\ResponseInterface The response * @throws \Cake\Controller\Exception\MissingActionException If controller action is not found. * @throws \UnexpectedValueException If return value of action method is not null or ResponseInterface instance. - * @psalm-param \Cake\Controller\Controller $controller */ public function invoke($controller): ResponseInterface { + $this->controller = $controller; + + $middlewares = $controller->getMiddleware(); + + if ($middlewares) { + $middlewareQueue = new MiddlewareQueue($middlewares); + $runner = new Runner(); + + return $runner->run($middlewareQueue, $controller->getRequest(), $this); + } + + return $this->handle($controller->getRequest()); + } + + /** + * Invoke the action. + * + * @param \Psr\Http\Message\ServerRequestInterface $request Request instance. + * @return \Psr\Http\Message\ResponseInterface + */ + public function handle(ServerRequestInterface $request): ResponseInterface + { + $controller = $this->controller; + /** @psalm-suppress ArgumentTypeCoercion */ + $controller->setRequest($request); + $result = $controller->startupProcess(); if ($result instanceof ResponseInterface) { return $result; } + $action = $controller->getAction(); + $args = $this->getActionArgs( + $action, + array_values((array)$controller->getRequest()->getParam('pass')) + ); + $controller->invokeAction($action, $args); + + $result = $controller->shutdownProcess(); + if ($result instanceof ResponseInterface) { + return $result; + } - $args = []; - $reflection = new ReflectionFunction($action); - $passed = array_values((array)$controller->getRequest()->getParam('pass')); - foreach ($reflection->getParameters() as $i => $parameter) { - $position = $parameter->getPosition(); - $hasDefault = $parameter->isDefaultValueAvailable(); + return $controller->getResponse(); + } - // If there is no type we can't look in the container - // assume the parameter is a passed param + /** + * Get the arguments for the controller action invocation. + * + * @param \Closure $action Controller action. + * @param array $passedParams Params passed by the router. + * @return array + */ + protected function getActionArgs(Closure $action, array $passedParams): array + { + $resolved = []; + $function = new ReflectionFunction($action); + foreach ($function->getParameters() as $parameter) { $type = $parameter->getType(); - if (!$type) { - if (count($passed)) { - $args[$position] = array_shift($passed); - } elseif ($hasDefault) { - $args[$position] = $parameter->getDefaultValue(); + if ($type && !$type instanceof ReflectionNamedType) { + // Only single types are supported + throw new InvalidParameterException([ + 'template' => 'unsupported_type', + 'parameter' => $parameter->getName(), + 'controller' => $this->controller->getName(), + 'action' => $this->controller->getRequest()->getParam('action'), + 'prefix' => $this->controller->getRequest()->getParam('prefix'), + 'plugin' => $this->controller->getRequest()->getParam('plugin'), + ]); + } + + // Check for dependency injection for classes + if ($type instanceof ReflectionNamedType && !$type->isBuiltin()) { + $typeName = $type->getName(); + if ($this->container->has($typeName)) { + $resolved[] = $this->container->get($typeName); + continue; } - continue; + + // Use passedParams as a source of typed dependencies. + // The accepted types for passedParams was never defined and userland code relies on that. + if ($passedParams && is_object($passedParams[0]) && $passedParams[0] instanceof $typeName) { + $resolved[] = array_shift($passedParams); + continue; + } + + // Add default value if provided + // Do not allow positional arguments for classes + if ($parameter->isDefaultValueAvailable()) { + $resolved[] = $parameter->getDefaultValue(); + continue; + } + + throw new InvalidParameterException([ + 'template' => 'missing_dependency', + 'parameter' => $parameter->getName(), + 'type' => $typeName, + 'controller' => $this->controller->getName(), + 'action' => $this->controller->getRequest()->getParam('action'), + 'prefix' => $this->controller->getRequest()->getParam('prefix'), + 'plugin' => $this->controller->getRequest()->getParam('plugin'), + ]); } - $typeName = $type instanceof ReflectionNamedType ? ltrim($type->getName(), '?') : null; - - // Primitive types are passed args as they can't be looked up in the container. - // We only handle strings currently. - if ($typeName === 'string') { - if (count($passed)) { - $args[$position] = array_shift($passed); - } elseif ($hasDefault) { - $args[$position] = $parameter->getDefaultValue(); + + // Use any passed params as positional arguments + if ($passedParams) { + $argument = array_shift($passedParams); + if (is_string($argument) && $type instanceof ReflectionNamedType) { + $typedArgument = $this->coerceStringToType($argument, $type); + + if ($typedArgument === null) { + throw new InvalidParameterException([ + 'template' => 'failed_coercion', + 'passed' => $argument, + 'type' => $type->getName(), + 'parameter' => $parameter->getName(), + 'controller' => $this->controller->getName(), + 'action' => $this->controller->getRequest()->getParam('action'), + 'prefix' => $this->controller->getRequest()->getParam('prefix'), + 'plugin' => $this->controller->getRequest()->getParam('plugin'), + ]); + } + $argument = $typedArgument; } + + $resolved[] = $argument; continue; } - // Check the container and parameter default value. - if ($typeName && $this->container->has($typeName)) { - $args[$position] = $this->container->get($typeName); - } elseif ($hasDefault) { - $args[$position] = $parameter->getDefaultValue(); + // Add default value if provided + if ($parameter->isDefaultValueAvailable()) { + $resolved[] = $parameter->getDefaultValue(); + continue; } - if (!array_key_exists($position, $args)) { - throw new InvalidArgumentException( - "Could not resolve action argument `{$parameter->getName()}`. " . - 'It has no definition in the container, no passed parameter, and no default value.' - ); + + // Variadic parameter can have 0 arguments + if ($parameter->isVariadic()) { + continue; } + + throw new InvalidParameterException([ + 'template' => 'missing_parameter', + 'parameter' => $parameter->getName(), + 'controller' => $this->controller->getName(), + 'action' => $this->controller->getRequest()->getParam('action'), + 'prefix' => $this->controller->getRequest()->getParam('prefix'), + 'plugin' => $this->controller->getRequest()->getParam('plugin'), + ]); } - if (count($passed)) { - $args = array_merge($args, $passed); - } - $controller->invokeAction($action, $args); - $result = $controller->shutdownProcess(); - if ($result instanceof ResponseInterface) { - return $result; + return array_merge($resolved, $passedParams); + } + + /** + * Coerces string argument to primitive type. + * + * @param string $argument Argument to coerce + * @param \ReflectionNamedType $type Parameter type + * @return array|string|float|int|bool|null + */ + protected function coerceStringToType(string $argument, ReflectionNamedType $type) + { + switch ($type->getName()) { + case 'string': + return $argument; + case 'float': + return is_numeric($argument) ? (float)$argument : null; + case 'int': + return ctype_digit($argument) ? (int)$argument : null; + case 'bool': + return $argument === '0' ? false : ($argument === '1' ? true : null); + case 'array': + return $argument === '' ? [] : explode(',', $argument); } - return $controller->getResponse(); + return null; } /** diff --git a/app/vendor/cakephp/cakephp/src/Core/App.php b/app/vendor/cakephp/cakephp/src/Core/App.php index 9330b5ca..3f5c9a0b 100644 --- a/app/vendor/cakephp/cakephp/src/Core/App.php +++ b/app/vendor/cakephp/cakephp/src/Core/App.php @@ -59,13 +59,16 @@ public static function className(string $class, string $type = '', string $suffi } [$plugin, $name] = pluginSplit($class); - $base = $plugin ?: Configure::read('App.namespace'); - $base = str_replace('/', '\\', rtrim($base, '\\')); $fullname = '\\' . str_replace('/', '\\', $type . '\\' . $name) . $suffix; - if (static::_classExistsInBase($fullname, $base)) { - /** @var class-string */ - return $base . $fullname; + $base = $plugin ?: Configure::read('App.namespace'); + if ($base !== null) { + $base = str_replace('/', '\\', rtrim($base, '\\')); + + if (static::_classExistsInBase($fullname, $base)) { + /** @var class-string */ + return $base . $fullname; + } } if ($plugin || !static::_classExistsInBase($fullname, 'Cake')) { @@ -126,11 +129,11 @@ public static function shortName(string $class, string $type, string $suffix = ' return $class; } - $pluginName = substr($class, 0, $pos); - $name = substr($class, $pos + strlen($type)); + $pluginName = (string)substr($class, 0, $pos); + $name = (string)substr($class, $pos + strlen($type)); if ($suffix) { - $name = substr($name, 0, -strlen($suffix)); + $name = (string)substr($name, 0, -strlen($suffix)); } $nonPluginNamespaces = [ @@ -182,7 +185,7 @@ protected static function _classExistsInBase(string $name, string $namespace): b * * @param string $type Type of path * @param string|null $plugin Plugin name - * @return string[] + * @return array * @link https://book.cakephp.org/4/en/core-libraries/app.html#finding-paths-to-namespaces */ public static function path(string $type, ?string $plugin = null): array @@ -228,7 +231,7 @@ public static function path(string $type, ?string $plugin = null): array * * @param string $type Package type. * @param string|null $plugin Plugin name. - * @return string[] + * @return array */ public static function classPath(string $type, ?string $plugin = null): array { @@ -253,7 +256,7 @@ public static function classPath(string $type, ?string $plugin = null): array * Will return the full path to the cache engines package. * * @param string $type Package type. - * @return string[] Full path to package + * @return array Full path to package */ public static function core(string $type): array { diff --git a/app/vendor/cakephp/cakephp/src/Core/BasePlugin.php b/app/vendor/cakephp/cakephp/src/Core/BasePlugin.php index 0ab41df2..08e5905d 100644 --- a/app/vendor/cakephp/cakephp/src/Core/BasePlugin.php +++ b/app/vendor/cakephp/cakephp/src/Core/BasePlugin.php @@ -18,14 +18,15 @@ use Cake\Console\CommandCollection; use Cake\Http\MiddlewareQueue; use Cake\Routing\RouteBuilder; +use Closure; use InvalidArgumentException; use ReflectionClass; /** * Base Plugin Class * - * Every plugin should extends from this class or implement the interfaces and - * include a plugin class in it's src root folder. + * Every plugin should extend from this class or implement the interfaces and + * include a plugin class in its src root folder. */ class BasePlugin implements PluginInterface { @@ -102,7 +103,7 @@ class BasePlugin implements PluginInterface /** * Constructor * - * @param array $options Options + * @param array $options Options */ public function __construct(array $options = []) { @@ -258,7 +259,10 @@ public function routes(RouteBuilder $routes): void { $path = $this->getConfigPath() . 'routes.php'; if (is_file($path)) { - require $path; + $return = require $path; + if ($return instanceof Closure) { + $return($routes); + } } } diff --git a/app/vendor/cakephp/cakephp/src/Core/ClassLoader.php b/app/vendor/cakephp/cakephp/src/Core/ClassLoader.php index 56a32779..e2a75255 100644 --- a/app/vendor/cakephp/cakephp/src/Core/ClassLoader.php +++ b/app/vendor/cakephp/cakephp/src/Core/ClassLoader.php @@ -26,7 +26,7 @@ class ClassLoader * An associative array where the key is a namespace prefix and the value * is an array of base directories for classes in that namespace. * - * @var array + * @var array */ protected $_prefixes = []; @@ -37,7 +37,9 @@ class ClassLoader */ public function register(): void { - spl_autoload_register([$this, 'loadClass']); + /** @var callable $callable */ + $callable = [$this, 'loadClass']; + spl_autoload_register($callable); } /** @@ -58,9 +60,7 @@ public function addNamespace(string $prefix, string $baseDir, bool $prepend = fa $baseDir = rtrim($baseDir, '/') . DIRECTORY_SEPARATOR; $baseDir = rtrim($baseDir, DIRECTORY_SEPARATOR) . '/'; - if (!isset($this->_prefixes[$prefix])) { - $this->_prefixes[$prefix] = []; - } + $this->_prefixes[$prefix] = $this->_prefixes[$prefix] ?? []; if ($prepend) { array_unshift($this->_prefixes[$prefix], $baseDir); diff --git a/app/vendor/cakephp/cakephp/src/Core/Configure.php b/app/vendor/cakephp/cakephp/src/Core/Configure.php index 3d3d2848..e4e8f10d 100644 --- a/app/vendor/cakephp/cakephp/src/Core/Configure.php +++ b/app/vendor/cakephp/cakephp/src/Core/Configure.php @@ -47,12 +47,12 @@ class Configure * Configured engine classes, used to load config files from resources * * @see \Cake\Core\Configure::load() - * @var \Cake\Core\Configure\ConfigEngineInterface[] + * @var array<\Cake\Core\Configure\ConfigEngineInterface> */ protected static $_engines = []; /** - * Flag to track whether or not ini_set exists. + * Flag to track whether ini_set exists. * * @var bool|null */ @@ -76,7 +76,7 @@ class Configure * ]); * ``` * - * @param string|array $config The key to write, can be a dot notation value. + * @param array|string $config The key to write, can be a dot notation value. * Alternatively can be an array containing key(s) and value(s). * @param mixed $value Value to set for var * @return void @@ -270,7 +270,7 @@ public static function isConfigured(string $name): bool /** * Gets the names of the configured Engine objects. * - * @return string[] + * @return array */ public static function configured(): array { @@ -321,15 +321,23 @@ public static function drop(string $name): bool * @param string $key name of configuration resource to load. * @param string $config Name of the configured engine to use to read the resource identified by $key. * @param bool $merge if config files should be merged instead of simply overridden - * @return bool False if file not found, true if load successful. + * @return bool True if load successful. + * @throws \Cake\Core\Exception\CakeException if the $config engine is not found * @link https://book.cakephp.org/4/en/development/configuration.html#reading-and-writing-configuration-files */ public static function load(string $key, string $config = 'default', bool $merge = true): bool { $engine = static::_getEngine($config); if (!$engine) { - return false; + throw new CakeException( + sprintf( + 'Config %s engine not found when attempting to load %s.', + $config, + $key + ) + ); } + $values = $engine->read($key); if ($merge) { @@ -365,7 +373,7 @@ public static function load(string $key, string $config = 'default', bool $merge * @param string $key The identifier to create in the config adapter. * This could be a filename or a cache key depending on the adapter being used. * @param string $config The name of the configured adapter to dump data with. - * @param string[] $keys The name of the top-level keys you want to dump. + * @param array $keys The name of the top-level keys you want to dump. * This allows you save only some data stored in Configure. * @return bool Success * @throws \Cake\Core\Exception\CakeException if the adapter does not implement a `dump` method. diff --git a/app/vendor/cakephp/cakephp/src/Core/Configure/Engine/PhpConfig.php b/app/vendor/cakephp/cakephp/src/Core/Configure/Engine/PhpConfig.php index 581a11b2..6bdf3a42 100644 --- a/app/vendor/cakephp/cakephp/src/Core/Configure/Engine/PhpConfig.php +++ b/app/vendor/cakephp/cakephp/src/Core/Configure/Engine/PhpConfig.php @@ -25,7 +25,7 @@ * files containing simple PHP arrays. * * Files compatible with PhpConfig should return an array that - * contains all of the configuration data contained in the file. + * contains all the configuration data contained in the file. * * An example configuration file would look like:: * diff --git a/app/vendor/cakephp/cakephp/src/Core/ContainerInterface.php b/app/vendor/cakephp/cakephp/src/Core/ContainerInterface.php index cd48aa89..244e45f7 100644 --- a/app/vendor/cakephp/cakephp/src/Core/ContainerInterface.php +++ b/app/vendor/cakephp/cakephp/src/Core/ContainerInterface.php @@ -16,8 +16,7 @@ */ namespace Cake\Core; -use League\Container\Definition\DefinitionInterface; -use Psr\Container\ContainerInterface as PsrInterface; +use League\Container\DefinitionContainerInterface; /** * Interface for the Dependency Injection Container in CakePHP applications @@ -31,33 +30,6 @@ * @experimental This interface is not final and can have additional * methods and parameters added in future minor releases. */ -interface ContainerInterface extends PsrInterface +interface ContainerInterface extends DefinitionContainerInterface { - /** - * Add an item to the container. - * - * @param string $id The class name or name of the service being registered. - * @param mixed $concrete Either the classname an interface or name resolves to. - * Can also be a constructed object, Closure, or null. When null, the `$id` parameter will - * be used as the concrete class name. - * @param bool $shared Set to true to make a service shared. - * @return \League\Container\Definition\DefinitionInterface - */ - public function add(string $id, $concrete = null, bool $shared = false): DefinitionInterface; - - /** - * Add a service provider to the container - * - * @param \League\Container\ServiceProvider\ServiceProviderInterface $provider The service provider to add. - * @return $this - */ - public function addServiceProvider($provider); - - /** - * Modify an existing definition - * - * @param string $id The class name or name of the service being modified. - * @return \League\Container\Definition\DefinitionInterface - */ - public function extend(string $id): DefinitionInterface; } diff --git a/app/vendor/cakephp/cakephp/src/Core/Exception/CakeException.php b/app/vendor/cakephp/cakephp/src/Core/Exception/CakeException.php index e65d05da..82ef4373 100644 --- a/app/vendor/cakephp/cakephp/src/Core/Exception/CakeException.php +++ b/app/vendor/cakephp/cakephp/src/Core/Exception/CakeException.php @@ -40,7 +40,7 @@ class CakeException extends RuntimeException protected $_messageTemplate = ''; /** - * Array of headers to be passed to Cake\Http\Response::header() + * Array of headers to be passed to {@link \Cake\Http\Response::withHeader()} * * @var array|null */ @@ -59,7 +59,7 @@ class CakeException extends RuntimeException * Allows you to create exceptions that are treated as framework errors and disabled * when debug mode is off. * - * @param string|array $message Either the string of the error message, or an array of attributes + * @param array|string $message Either the string of the error message, or an array of attributes * that are made available in the view, and sprintf()'d into Exception::$_messageTemplate * @param int|null $code The error code * @param \Throwable|null $previous the previous exception. @@ -86,9 +86,9 @@ public function getAttributes(): array /** * Get/set the response header to be used * - * See also Cake\Http\Response::withHeader() + * See also {@link \Cake\Http\Response::withHeader()} * - * @param string|array|null $header A single header string or an associative + * @param array|string|null $header A single header string or an associative * array of "header name" => "header value" * @param string|null $value The header value. * @return array|null diff --git a/app/vendor/cakephp/cakephp/src/Core/InstanceConfigTrait.php b/app/vendor/cakephp/cakephp/src/Core/InstanceConfigTrait.php index d5a2e1ef..8813a196 100644 --- a/app/vendor/cakephp/cakephp/src/Core/InstanceConfigTrait.php +++ b/app/vendor/cakephp/cakephp/src/Core/InstanceConfigTrait.php @@ -30,7 +30,7 @@ trait InstanceConfigTrait /** * Runtime config * - * @var array + * @var array */ protected $_config = []; @@ -64,7 +64,7 @@ trait InstanceConfigTrait * $this->setConfig(['one' => 'value', 'another' => 'value']); * ``` * - * @param string|array $key The key to set, or a complete array of configs. + * @param array|string $key The key to set, or a complete array of configs. * @param mixed|null $value The value to set. * @param bool $merge Whether to recursively merge or overwrite existing config, defaults to true. * @return $this @@ -168,7 +168,7 @@ public function getConfigOrFail(string $key) * $this->configShallow(['one' => 'value', 'another' => 'value']); * ``` * - * @param string|array $key The key to set, or a complete array of configs. + * @param array|string $key The key to set, or a complete array of configs. * @param mixed|null $value The value to set. * @return $this */ @@ -217,9 +217,9 @@ protected function _configRead(?string $key) /** * Writes a config key. * - * @param string|array $key Key to write to. + * @param array|string $key Key to write to. * @param mixed $value Value to write. - * @param bool|string $merge True to merge recursively, 'shallow' for simple merge, + * @param string|bool $merge True to merge recursively, 'shallow' for simple merge, * false to overwrite, defaults to false. * @return void * @throws \Cake\Core\Exception\CakeException if attempting to clobber existing config @@ -265,9 +265,7 @@ protected function _configWrite($key, $value, $merge = false): void throw new CakeException(sprintf('Cannot set %s value', $key)); } - if (!isset($update[$k])) { - $update[$k] = []; - } + $update[$k] = $update[$k] ?? []; $update = &$update[$k]; } diff --git a/app/vendor/cakephp/cakephp/src/Core/ObjectRegistry.php b/app/vendor/cakephp/cakephp/src/Core/ObjectRegistry.php index 3ff380a7..5fc7e5aa 100644 --- a/app/vendor/cakephp/cakephp/src/Core/ObjectRegistry.php +++ b/app/vendor/cakephp/cakephp/src/Core/ObjectRegistry.php @@ -46,7 +46,7 @@ abstract class ObjectRegistry implements Countable, IteratorAggregate /** * Map of loaded objects. * - * @var object[] + * @var array * @psalm-var array */ protected $_loaded = []; @@ -58,7 +58,7 @@ abstract class ObjectRegistry implements Countable, IteratorAggregate * If a subclass provides event support, you can use `$config['enabled'] = false` * to exclude constructed objects from being registered for events. * - * Using Cake\Controller\Controller::$components as an example. You can alias + * Using {@link \Cake\Controller\Component::$components} as an example. You can alias * an object by setting the 'className' key, i.e., * * ``` @@ -72,7 +72,7 @@ abstract class ObjectRegistry implements Countable, IteratorAggregate * All calls to the `Email` component would use `AliasedEmail` instead. * * @param string $name The name/class of the object to load. - * @param array $config Additional settings to use when loading the object. + * @param array $config Additional settings to use when loading the object. * @return mixed * @psalm-return TObject * @throws \Exception If the class cannot be found. @@ -125,7 +125,7 @@ public function load(string $name, array $config = []) * logic dependent on the configuration. * * @param string $name The name of the alias in the registry. - * @param array $config The config data for the new instance. + * @param array $config The config data for the new instance. * @return void * @throws \RuntimeException When a duplicate is found. */ @@ -189,11 +189,11 @@ abstract protected function _throwMissingClassError(string $class, ?string $plug * This method should construct and do any other initialization logic * required. * - * @param string|object $class The class to build. + * @param object|string $class The class to build. * @param string $alias The alias of the object. - * @param array $config The Configuration settings for construction + * @param array $config The Configuration settings for construction * @return object - * @psalm-param string|TObject $class + * @psalm-param TObject|string $class * @psalm-return TObject */ abstract protected function _create($class, string $alias, array $config); @@ -201,7 +201,7 @@ abstract protected function _create($class, string $alias, array $config); /** * Get the list of loaded objects. * - * @return string[] List of object names. + * @return array List of object names. */ public function loaded(): array { @@ -209,7 +209,7 @@ public function loaded(): array } /** - * Check whether or not a given object is loaded. + * Check whether a given object is loaded. * * @param string $name The object name to check for. * @return bool True is object is loaded else false. @@ -288,7 +288,7 @@ public function __unset(string $name): void * easier * * @param array $objects Array of child objects to normalize. - * @return array[] Array of normalized objects. + * @return array Array of normalized objects. */ public function normalizeArray(array $objects): array { @@ -405,7 +405,7 @@ public function count(): int /** * Debug friendly object properties. * - * @return array + * @return array */ public function __debugInfo(): array { diff --git a/app/vendor/cakephp/cakephp/src/Core/Plugin.php b/app/vendor/cakephp/cakephp/src/Core/Plugin.php index e41047f3..67e1a636 100644 --- a/app/vendor/cakephp/cakephp/src/Core/Plugin.php +++ b/app/vendor/cakephp/cakephp/src/Core/Plugin.php @@ -104,7 +104,7 @@ public static function isLoaded(string $plugin): bool /** * Return a list of loaded plugins. * - * @return string[] A list of plugins that have been loaded + * @return array A list of plugins that have been loaded */ public static function loaded(): array { diff --git a/app/vendor/cakephp/cakephp/src/Core/PluginApplicationInterface.php b/app/vendor/cakephp/cakephp/src/Core/PluginApplicationInterface.php index 17d6b4d7..0ba07714 100644 --- a/app/vendor/cakephp/cakephp/src/Core/PluginApplicationInterface.php +++ b/app/vendor/cakephp/cakephp/src/Core/PluginApplicationInterface.php @@ -36,8 +36,8 @@ interface PluginApplicationInterface extends EventDispatcherInterface * instance of `Cake\Core\BasePlugin` will be used. This generated class will have * all plugin hooks enabled. * - * @param string|\Cake\Core\PluginInterface $name The plugin name or plugin object. - * @param array $config The configuration data for the plugin if using a string for $name + * @param \Cake\Core\PluginInterface|string $name The plugin name or plugin object. + * @param array $config The configuration data for the plugin if using a string for $name * @return $this */ public function addPlugin($name, array $config = []); diff --git a/app/vendor/cakephp/cakephp/src/Core/PluginCollection.php b/app/vendor/cakephp/cakephp/src/Core/PluginCollection.php index 793e8422..4c85e326 100644 --- a/app/vendor/cakephp/cakephp/src/Core/PluginCollection.php +++ b/app/vendor/cakephp/cakephp/src/Core/PluginCollection.php @@ -40,21 +40,21 @@ class PluginCollection implements Iterator, Countable /** * Plugin list * - * @var \Cake\Core\PluginInterface[] + * @var array<\Cake\Core\PluginInterface> */ protected $plugins = []; /** * Names of plugins * - * @var string[] + * @var array */ protected $names = []; /** * Iterator position stack. * - * @var int[] + * @var array */ protected $positions = []; @@ -68,7 +68,7 @@ class PluginCollection implements Iterator, Countable /** * Constructor * - * @param \Cake\Core\PluginInterface[] $plugins The map of plugins to add to the collection. + * @param array<\Cake\Core\PluginInterface> $plugins The map of plugins to add to the collection. */ public function __construct(array $plugins = []) { @@ -115,7 +115,7 @@ protected function loadConfig(): void * This method is not part of the official public API as plugins with * no plugin class are being phased out. * - * @param string $name The plugin name to locate a path for. Will return '' when a plugin cannot be found. + * @param string $name The plugin name to locate a path for. * @return string * @throws \Cake\Core\Exception\MissingPluginException when a plugin path cannot be resolved. * @internal @@ -226,7 +226,7 @@ public function get(string $name): PluginInterface * Create a plugin instance from a name/classname and configuration. * * @param string $name The plugin name or classname - * @param array $config Configuration options for the plugin. + * @param array $config Configuration options for the plugin. * @return \Cake\Core\PluginInterface * @throws \Cake\Core\Exception\MissingPluginException When plugin instance could not be created. */ @@ -326,9 +326,8 @@ public function valid(): bool * Filter the plugins to those with the named hook enabled. * * @param string $hook The hook to filter plugins by - * @return \Generator&\Cake\Core\PluginInterface[] A generator containing matching plugins. + * @return \Generator<\Cake\Core\PluginInterface> A generator containing matching plugins. * @throws \InvalidArgumentException on invalid hooks - * @psalm-return \Generator<\Cake\Core\PluginInterface> */ public function with(string $hook): Generator { diff --git a/app/vendor/cakephp/cakephp/src/Core/PluginInterface.php b/app/vendor/cakephp/cakephp/src/Core/PluginInterface.php index e0cea8df..e251cdf5 100644 --- a/app/vendor/cakephp/cakephp/src/Core/PluginInterface.php +++ b/app/vendor/cakephp/cakephp/src/Core/PluginInterface.php @@ -29,7 +29,7 @@ interface PluginInterface /** * List of valid hooks. * - * @var string[] + * @var array */ public const VALID_HOOKS = ['bootstrap', 'console', 'middleware', 'routes', 'services']; diff --git a/app/vendor/cakephp/cakephp/src/Core/Retry/CommandRetry.php b/app/vendor/cakephp/cakephp/src/Core/Retry/CommandRetry.php index ac65c57c..1211695d 100644 --- a/app/vendor/cakephp/cakephp/src/Core/Retry/CommandRetry.php +++ b/app/vendor/cakephp/cakephp/src/Core/Retry/CommandRetry.php @@ -22,7 +22,7 @@ * Allows any action to be retried in case of an exception. * * This class can be parametrized with a strategy, which will be followed - * to determine whether or not the action should be retried. + * to determine whether the action should be retried. */ class CommandRetry { diff --git a/app/vendor/cakephp/cakephp/src/Core/Retry/RetryStrategyInterface.php b/app/vendor/cakephp/cakephp/src/Core/Retry/RetryStrategyInterface.php index 7a62b9ca..e2ef9e21 100644 --- a/app/vendor/cakephp/cakephp/src/Core/Retry/RetryStrategyInterface.php +++ b/app/vendor/cakephp/cakephp/src/Core/Retry/RetryStrategyInterface.php @@ -19,7 +19,7 @@ use Exception; /** - * Used to instruct a CommandRetry object on whether or not a retry + * Used to instruct a CommandRetry object on whether a retry * for an action should be performed */ interface RetryStrategyInterface @@ -29,7 +29,7 @@ interface RetryStrategyInterface * * @param \Exception $exception The exception that caused the action to fail * @param int $retryCount The number of times action has been retried - * @return bool Whether or not it is OK to retry the action + * @return bool Whether it is OK to retry the action */ public function shouldRetry(Exception $exception, int $retryCount): bool; } diff --git a/app/vendor/cakephp/cakephp/src/Core/ServiceConfig.php b/app/vendor/cakephp/cakephp/src/Core/ServiceConfig.php index 462afdf4..6eac909f 100644 --- a/app/vendor/cakephp/cakephp/src/Core/ServiceConfig.php +++ b/app/vendor/cakephp/cakephp/src/Core/ServiceConfig.php @@ -19,9 +19,9 @@ /** * Read-only wrapper for configuration data * - * Intended for use with Cake\Core\Container as + * Intended for use with {@link \Cake\Core\Container} as * a typehintable way for services to have application - * confiugration injected as arrays cannot be typehinted. + * configuration injected as arrays cannot be typehinted. */ class ServiceConfig { diff --git a/app/vendor/cakephp/cakephp/src/Core/ServiceProvider.php b/app/vendor/cakephp/cakephp/src/Core/ServiceProvider.php index 269057db..b2ed8add 100644 --- a/app/vendor/cakephp/cakephp/src/Core/ServiceProvider.php +++ b/app/vendor/cakephp/cakephp/src/Core/ServiceProvider.php @@ -16,9 +16,9 @@ */ namespace Cake\Core; +use League\Container\DefinitionContainerInterface; use League\Container\ServiceProvider\AbstractServiceProvider; use League\Container\ServiceProvider\BootableServiceProviderInterface; -use Psr\Container\ContainerInterface as PsrContainerInterface; use RuntimeException; /** @@ -34,6 +34,14 @@ */ abstract class ServiceProvider extends AbstractServiceProvider implements BootableServiceProviderInterface { + /** + * List of ids of services this provider provides. + * + * @var array + * @see ServiceProvider::provides() + */ + protected $provides = []; + /** * Get the container. * @@ -42,9 +50,10 @@ abstract class ServiceProvider extends AbstractServiceProvider implements Bootab * * @return \Cake\Core\ContainerInterface */ - public function getContainer(): PsrContainerInterface + public function getContainer(): DefinitionContainerInterface { $container = parent::getContainer(); + if (!($container instanceof ContainerInterface)) { $message = sprintf( 'Unexpected container type. Expected `%s` got `%s` instead.', @@ -93,11 +102,26 @@ public function bootstrap(ContainerInterface $container): void * * @return void */ - public function register() + public function register(): void { $this->services($this->getContainer()); } + /** + * The provides method is a way to let the container know that a service + * is provided by this service provider. + * + * Every service that is registered via this service provider must have an + * alias added to this array or it will be ignored. + * + * @param string $id Identifier. + * @return bool + */ + public function provides(string $id): bool + { + return in_array($id, $this->provides, true); + } + /** * Register the services in a provider. * diff --git a/app/vendor/cakephp/cakephp/src/Core/StaticConfigTrait.php b/app/vendor/cakephp/cakephp/src/Core/StaticConfigTrait.php index 2e9ffd53..c11a12c6 100644 --- a/app/vendor/cakephp/cakephp/src/Core/StaticConfigTrait.php +++ b/app/vendor/cakephp/cakephp/src/Core/StaticConfigTrait.php @@ -32,7 +32,7 @@ trait StaticConfigTrait /** * Configuration sets. * - * @var array + * @var array */ protected static $_config = []; @@ -67,8 +67,8 @@ trait StaticConfigTrait * Cache::setConfig($arrayOfConfig); * ``` * - * @param string|array $key The name of the configuration, or an array of multiple configs. - * @param array|object|null $config An array of name => configuration data for adapter. + * @param array|string $key The name of the configuration, or an array of multiple configs. + * @param object|array|null $config An array of name => configuration data for adapter. * @throws \BadMethodCallException When trying to modify an existing config. * @throws \LogicException When trying to store an invalid structured config array. * @return void @@ -167,7 +167,7 @@ public static function drop(string $config): bool /** * Returns an array containing the named configurations * - * @return string[] Array of configurations. + * @return array Array of configurations. */ public static function configured(): array { @@ -207,7 +207,7 @@ public static function configured(): array * Note that querystring arguments are also parsed and set as values in the returned configuration. * * @param string $dsn The DSN string to convert to a configuration array - * @return array The configuration array to be stored after parsing the DSN + * @return array The configuration array to be stored after parsing the DSN * @throws \InvalidArgumentException If not passed a string, or passed an invalid string */ public static function parseDsn(string $dsn): array @@ -303,7 +303,7 @@ public static function parseDsn(string $dsn): array /** * Updates the DSN class map for this class. * - * @param string[] $map Additions/edits to the class map to apply. + * @param array $map Additions/edits to the class map to apply. * @return void * @psalm-param array $map */ @@ -315,7 +315,7 @@ public static function setDsnClassMap(array $map): void /** * Returns the DSN class map for this class. * - * @return string[] + * @return array * @psalm-return array */ public static function getDsnClassMap(): array diff --git a/app/vendor/cakephp/cakephp/src/Core/functions.php b/app/vendor/cakephp/cakephp/src/Core/functions.php index 2a25c990..2ca8619e 100644 --- a/app/vendor/cakephp/cakephp/src/Core/functions.php +++ b/app/vendor/cakephp/cakephp/src/Core/functions.php @@ -110,7 +110,7 @@ function pluginSplit(string $name, bool $dotAppend = false, ?string $plugin = nu * Commonly used like `list($namespace, $className) = namespaceSplit($class);`. * * @param string $class The full class name, ie `Cake\Core\App`. - * @return string[] Array with 2 indexes. 0 => namespace, 1 => classname. + * @return array Array with 2 indexes. 0 => namespace, 1 => classname. */ function namespaceSplit(string $class): array { @@ -206,12 +206,8 @@ function env(string $key, $default = null) $key = 'SCRIPT_URL'; } - $val = null; - if (isset($_SERVER[$key])) { - $val = $_SERVER[$key]; - } elseif (isset($_ENV[$key])) { - $val = $_ENV[$key]; - } elseif (getenv($key) !== false) { + $val = $_SERVER[$key] ?? $_ENV[$key] ?? null; + if ($val == null && getenv($key) !== false) { $val = getenv($key); } @@ -256,10 +252,9 @@ function env(string $key, $default = null) */ function triggerWarning(string $message): void { - $stackFrame = 1; $trace = debug_backtrace(); - if (isset($trace[$stackFrame])) { - $frame = $trace[$stackFrame]; + if (isset($trace[1])) { + $frame = $trace[1]; $frame += ['file' => '[internal]', 'line' => '??']; $message = sprintf( '%s - %s, line: %s', @@ -302,10 +297,10 @@ function deprecationWarning(string $message, int $stackFrame = 1): void } $message = sprintf( - '%s - %s, line: %s' . "\n" . - ' You can disable all deprecation warnings by setting `Error.errorLevel` to' . - ' `E_ALL & ~E_USER_DEPRECATED`, or add `%s` to ' . - ' `Error.ignoredDeprecationPaths` in your `config/app.php` to mute deprecations from only this file.', + "%s\n%s, line: %s\n" . + 'You can disable all deprecation warnings by setting `Error.errorLevel` to ' . + '`E_ALL & ~E_USER_DEPRECATED`. Adding `%s` to `Error.ignoredDeprecationPaths` ' . + 'in your `config/app.php` config will mute deprecations from that file only.', $message, $frame['file'], $frame['line'], @@ -313,6 +308,16 @@ function deprecationWarning(string $message, int $stackFrame = 1): void ); } + static $errors = []; + $checksum = md5($message); + $duplicate = (bool)Configure::read('Error.allowDuplicateDeprecations', false); + if (isset($errors[$checksum]) && !$duplicate) { + return; + } + if (!$duplicate) { + $errors[$checksum] = true; + } + trigger_error($message, E_USER_DEPRECATED); } } diff --git a/app/vendor/cakephp/cakephp/src/Database/Connection.php b/app/vendor/cakephp/cakephp/src/Database/Connection.php index baa95705..5153d0e8 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Connection.php +++ b/app/vendor/cakephp/cakephp/src/Database/Connection.php @@ -47,7 +47,7 @@ class Connection implements ConnectionInterface /** * Contains the configuration params for this connection. * - * @var array + * @var array */ protected $_config; @@ -129,7 +129,7 @@ class Connection implements ConnectionInterface * If set to a string it will be used as the name of cache config to use. * - `cacheKeyPrefix` Custom prefix to use when generation cache keys. Defaults to connection name. * - * @param array $config Configuration array. + * @param array $config Configuration array. */ public function __construct(array $config) { @@ -171,11 +171,7 @@ public function config(): array */ public function configName(): string { - if (empty($this->_config['name'])) { - return ''; - } - - return $this->_config['name']; + return $this->_config['name'] ?? ''; } /** @@ -183,7 +179,7 @@ public function configName(): string * as a class name and will be instantiated. * * @param \Cake\Database\DriverInterface|string $driver The driver instance to use. - * @param array $config Config for a new driver. + * @param array $config Config for a new driver. * @throws \Cake\Database\Exception\MissingDriverException When a driver class is missing. * @throws \Cake\Database\Exception\MissingExtensionException When a driver's PHP extension is missing. * @return $this @@ -199,7 +195,7 @@ public function setDriver($driver, $config = []) $driver = new $className($config); } if (!$driver->enabled()) { - throw new MissingExtensionException(['driver' => get_class($driver)]); + throw new MissingExtensionException(['driver' => get_class($driver), 'name' => $config['name']]); } $this->_driver = $driver; @@ -275,7 +271,7 @@ public function isConnected(): bool /** * Prepares a SQL statement to be executed. * - * @param string|\Cake\Database\Query $query The SQL to convert into a prepared statement. + * @param \Cake\Database\Query|string $query The SQL to convert into a prepared statement. * @return \Cake\Database\StatementInterface */ public function prepare($query): StatementInterface @@ -410,7 +406,7 @@ public function getSchemaCollection(): SchemaCollectionInterface * * @param string $table the table to insert values in * @param array $values values to be inserted - * @param array $types list of associative array containing the types to be used for casting + * @param array $types list of associative array containing the types to be used for casting * @return \Cake\Database\StatementInterface */ public function insert(string $table, array $values, array $types = []): StatementInterface @@ -529,7 +525,7 @@ public function commit(): bool /** * Rollback current transaction. * - * @param bool|null $toBeginning Whether or not the transaction should be rolled back to the + * @param bool|null $toBeginning Whether the transaction should be rolled back to the * beginning of it. Defaults to false if using savepoints, or true if not. * @return bool */ @@ -571,7 +567,7 @@ public function rollback(?bool $toBeginning = null): bool * If you are trying to enable this feature, make sure you check * `isSavePointsEnabled()` to verify that savepoints were enabled successfully. * - * @param bool $enable Whether or not save points should be used. + * @param bool $enable Whether save points should be used. * @return $this */ public function enableSavePoints(bool $enable = true) @@ -579,7 +575,7 @@ public function enableSavePoints(bool $enable = true) if ($enable === false) { $this->_useSavePoints = false; } else { - $this->_useSavePoints = $this->_driver->supportsSavePoints(); + $this->_useSavePoints = $this->_driver->supports(DriverInterface::FEATURE_SAVEPOINT); } return $this; @@ -626,7 +622,10 @@ public function createSavePoint($name): void */ public function releaseSavePoint($name): void { - $this->execute($this->_driver->releaseSavePointSQL($name))->closeCursor(); + $sql = $this->_driver->releaseSavePointSQL($name); + if ($sql) { + $this->execute($sql)->closeCursor(); + } } /** @@ -669,6 +668,7 @@ public function enableForeignKeys(): void * to already created tables. * * @return bool true if driver supports dynamic constraints + * @deprecated 4.3.0 Fixtures no longer dynamically drop and create constraints. */ public function supportsDynamicConstraints(): bool { @@ -746,8 +746,10 @@ public function inTransaction(): bool /** * Quotes value to be used safely in database query. * + * This uses `PDO::quote()` and requires `supportsQuoting()` to work. + * * @param mixed $value The value to quote. - * @param string|int|\Cake\Database\TypeInterface $type Type to be used for determining kind of quoting to perform + * @param \Cake\Database\TypeInterface|string|int $type Type to be used for determining kind of quoting to perform * @return string Quoted value */ public function quote($value, $type = 'string'): string @@ -758,19 +760,23 @@ public function quote($value, $type = 'string'): string } /** - * Checks if the driver supports quoting. + * Checks if using `quote()` is supported. + * + * This is not required to use `quoteIdentifier()`. * * @return bool */ public function supportsQuoting(): bool { - return $this->_driver->supportsQuoting(); + return $this->_driver->supports(DriverInterface::FEATURE_QUOTE); } /** * Quotes a database identifier (a column name, table name, etc..) to * be used safely in queries without the risk of using reserved words. * + * This does not require `supportsQuoting()` to work. + * * @param string $identifier The identifier to quote. * @return string */ @@ -784,7 +790,7 @@ public function quoteIdentifier(string $identifier): string * * Changing this setting will not modify existing schema collections objects. * - * @param bool|string $cache Either boolean false to disable metadata caching, or + * @param string|bool $cache Either boolean false to disable metadata caching, or * true to use `_cake_model_` or the name of the cache config to use. * @return void */ @@ -933,7 +939,7 @@ protected function _newLogger(StatementInterface $statement): LoggingStatement * Returns an array that can be used to describe the internal state of this * object. * - * @return array + * @return array */ public function __debugInfo(): array { diff --git a/app/vendor/cakephp/cakephp/src/Database/Driver.php b/app/vendor/cakephp/cakephp/src/Database/Driver.php index 6b56a8ea..249868c4 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Driver.php +++ b/app/vendor/cakephp/cakephp/src/Database/Driver.php @@ -40,7 +40,7 @@ abstract class Driver implements DriverInterface protected const MAX_ALIAS_LENGTH = null; /** - * @var int[] DB-specific error codes that allow connect retry + * @var array DB-specific error codes that allow connect retry */ protected const RETRY_ERROR_CODES = []; @@ -54,7 +54,7 @@ abstract class Driver implements DriverInterface /** * Configuration data. * - * @var array + * @var array */ protected $_config; @@ -62,25 +62,18 @@ abstract class Driver implements DriverInterface * Base configuration that is merged into the user * supplied configuration data. * - * @var array + * @var array */ protected $_baseConfig = []; /** - * Indicates whether or not the driver is doing automatic identifier quoting + * Indicates whether the driver is doing automatic identifier quoting * for all queries * * @var bool */ protected $_autoQuoting = false; - /** - * Whether or not the server supports common table expressions. - * - * @var bool|null - */ - protected $supportsCTEs = null; - /** * The server version * @@ -98,7 +91,7 @@ abstract class Driver implements DriverInterface /** * Constructor * - * @param array $config The configuration for the driver. + * @param array $config The configuration for the driver. * @throws \InvalidArgumentException */ public function __construct(array $config = []) @@ -119,7 +112,7 @@ public function __construct(array $config = []) * Establishes a connection to the database server * * @param string $dsn A Driver-specific PDO-DSN - * @param array $config configuration to be used for creating connection + * @param array $config configuration to be used for creating connection * @return bool true on success */ protected function _connect(string $dsn, array $config): bool @@ -268,22 +261,39 @@ public function rollbackTransaction(): bool return $this->_connection->rollBack(); } + /** + * Returns whether a transaction is active for connection. + * + * @return bool + */ + public function inTransaction(): bool + { + $this->connect(); + + return $this->_connection->inTransaction(); + } + /** * @inheritDoc */ public function supportsSavePoints(): bool { - return true; + deprecationWarning('Feature support checks are now implemented by `supports()` with FEATURE_* constants.'); + + return $this->supports(static::FEATURE_SAVEPOINT); } /** * Returns true if the server supports common table expressions. * * @return bool + * @deprecated 4.3.0 Use `supports(DriverInterface::FEATURE_QUOTE)` instead */ public function supportsCTEs(): bool { - return $this->supportsCTEs === true; + deprecationWarning('Feature support checks are now implemented by `supports()` with FEATURE_* constants.'); + + return $this->supports(static::FEATURE_CTE); } /** @@ -300,12 +310,13 @@ public function quote($value, $type = PDO::PARAM_STR): string * Checks if the driver supports quoting, as PDO_ODBC does not support it. * * @return bool + * @deprecated 4.3.0 Use `supports(DriverInterface::FEATURE_QUOTE)` instead */ public function supportsQuoting(): bool { - $this->connect(); + deprecationWarning('Feature support checks are now implemented by `supports()` with FEATURE_* constants.'); - return $this->_connection->getAttribute(PDO::ATTR_DRIVER_NAME) !== 'odbc'; + return $this->supports(static::FEATURE_QUOTE); } /** @@ -378,7 +389,7 @@ public function lastInsertId(?string $table = null, ?string $column = null) return $this->_connection->lastInsertId($table); } - return $this->_connection->lastInsertId($table, $column); + return $this->_connection->lastInsertId($table); } /** @@ -427,6 +438,26 @@ public function isAutoQuotingEnabled(): bool return $this->_autoQuoting; } + /** + * Returns whether the driver supports the feature. + * + * Defaults to true for FEATURE_QUOTE and FEATURE_SAVEPOINT. + * + * @param string $feature Driver feature name + * @return bool + */ + public function supports(string $feature): bool + { + switch ($feature) { + case static::FEATURE_DISABLE_CONSTRAINT_WITHOUT_TRANSACTION: + case static::FEATURE_QUOTE: + case static::FEATURE_SAVEPOINT: + return true; + } + + return false; + } + /** * @inheritDoc */ @@ -463,7 +494,7 @@ public function newTableSchema(string $table, array $columns = []): TableSchema /** * Returns the maximum alias length allowed. - * This can be different than the maximum identifier length for columns. + * This can be different from the maximum identifier length for columns. * * @return int|null Maximum alias length or null if no limit */ @@ -495,7 +526,7 @@ public function __destruct() * Returns an array that can be used to describe the internal state of this * object. * - * @return array + * @return array */ public function __debugInfo(): array { diff --git a/app/vendor/cakephp/cakephp/src/Database/Driver/Mysql.php b/app/vendor/cakephp/cakephp/src/Database/Driver/Mysql.php index 8afe34a8..68f46ff7 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Driver/Mysql.php +++ b/app/vendor/cakephp/cakephp/src/Database/Driver/Mysql.php @@ -53,7 +53,7 @@ class Mysql extends Driver /** * Base configuration settings for MySQL driver * - * @var array + * @var array */ protected $_baseConfig = [ 'persistent' => true, @@ -75,20 +75,6 @@ class Mysql extends Driver */ protected $_schemaDialect; - /** - * Whether or not the server supports native JSON - * - * @var bool|null - */ - protected $_supportsNativeJson; - - /** - * Whether or not the connected server supports window functions. - * - * @var bool|null - */ - protected $_supportsWindowFunctions; - /** * String used to start a database identifier quoting to make it safe * @@ -116,9 +102,9 @@ class Mysql extends Driver /** * Mapping of feature to db server version for feature availability checks. * - * @var array + * @var array> */ - protected $featuresToVersionMap = [ + protected $featureVersions = [ 'mysql' => [ 'json' => '5.7.0', 'cte' => '8.0.0', @@ -200,7 +186,7 @@ public function enabled(): bool /** * Prepares a sql statement to be executed * - * @param string|\Cake\Database\Query $query The query to prepare. + * @param \Cake\Database\Query|string $query The query to prepare. * @return \Cake\Database\StatementInterface */ public function prepare($query): StatementInterface @@ -257,6 +243,25 @@ public function enableForeignKeySQL(): string return 'SET foreign_key_checks = 1'; } + /** + * @inheritDoc + */ + public function supports(string $feature): bool + { + switch ($feature) { + case static::FEATURE_CTE: + case static::FEATURE_JSON: + case static::FEATURE_WINDOW: + return version_compare( + $this->version(), + $this->featureVersions[$this->serverType][$feature], + '>=' + ); + } + + return parent::supports($feature); + } + /** * @inheritDoc */ @@ -302,53 +307,38 @@ public function version(): string * Returns true if the server supports common table expressions. * * @return bool + * @deprecated 4.3.0 Use `supports(DriverInterface::FEATURE_CTE)` instead */ public function supportsCTEs(): bool { - if ($this->supportsCTEs === null) { - $this->supportsCTEs = version_compare( - $this->version(), - $this->featuresToVersionMap[$this->serverType]['cte'], - '>=' - ); - } + deprecationWarning('Feature support checks are now implemented by `supports()` with FEATURE_* constants.'); - return $this->supportsCTEs; + return $this->supports(static::FEATURE_CTE); } /** * Returns true if the server supports native JSON columns * * @return bool + * @deprecated 4.3.0 Use `supports(DriverInterface::FEATURE_JSON)` instead */ public function supportsNativeJson(): bool { - if ($this->_supportsNativeJson === null) { - $this->_supportsNativeJson = version_compare( - $this->version(), - $this->featuresToVersionMap[$this->serverType]['json'], - '>=' - ); - } + deprecationWarning('Feature support checks are now implemented by `supports()` with FEATURE_* constants.'); - return $this->_supportsNativeJson; + return $this->supports(static::FEATURE_JSON); } /** * Returns true if the connected server supports window functions. * * @return bool + * @deprecated 4.3.0 Use `supports(DriverInterface::FEATURE_WINDOW)` instead */ public function supportsWindowFunctions(): bool { - if ($this->_supportsWindowFunctions === null) { - $this->_supportsWindowFunctions = version_compare( - $this->version(), - $this->featuresToVersionMap[$this->serverType]['window'], - '>=' - ); - } + deprecationWarning('Feature support checks are now implemented by `supports()` with FEATURE_* constants.'); - return $this->_supportsWindowFunctions; + return $this->supports(static::FEATURE_WINDOW); } } diff --git a/app/vendor/cakephp/cakephp/src/Database/Driver/Postgres.php b/app/vendor/cakephp/cakephp/src/Database/Driver/Postgres.php index 51ca030b..2a32264c 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Driver/Postgres.php +++ b/app/vendor/cakephp/cakephp/src/Database/Driver/Postgres.php @@ -42,7 +42,7 @@ class Postgres extends Driver /** * Base configuration settings for Postgres driver * - * @var array + * @var array */ protected $_baseConfig = [ 'persistent' => true, @@ -79,11 +79,6 @@ class Postgres extends Driver */ protected $_endQuote = '"'; - /** - * @inheritDoc - */ - protected $supportsCTEs = true; - /** * Establishes a connection to the database server * @@ -190,6 +185,25 @@ public function enableForeignKeySQL(): string return 'SET CONSTRAINTS ALL IMMEDIATE'; } + /** + * @inheritDoc + */ + public function supports(string $feature): bool + { + switch ($feature) { + case static::FEATURE_CTE: + case static::FEATURE_JSON: + case static::FEATURE_TRUNCATE_WITH_CONSTRAINTS: + case static::FEATURE_WINDOW: + return true; + + case static::FEATURE_DISABLE_CONSTRAINT_WITHOUT_TRANSACTION: + return false; + } + + return parent::supports($feature); + } + /** * @inheritDoc */ diff --git a/app/vendor/cakephp/cakephp/src/Database/Driver/SqlDialectTrait.php b/app/vendor/cakephp/cakephp/src/Database/Driver/SqlDialectTrait.php index 03827321..7bcabda6 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Driver/SqlDialectTrait.php +++ b/app/vendor/cakephp/cakephp/src/Database/Driver/SqlDialectTrait.php @@ -73,14 +73,14 @@ public function quoteIdentifier(string $identifier): string } // string.string with spaces - if (preg_match('/^([\w-]+\.[\w][\w\s\-]*[\w])(.*)/u', $identifier, $matches)) { + if (preg_match('/^([\w-]+\.[\w][\w\s-]*[\w])(.*)/u', $identifier, $matches)) { $items = explode('.', $matches[1]); $field = implode($this->_endQuote . '.' . $this->_startQuote, $items); return $this->_startQuote . $field . $this->_endQuote . $matches[2]; } - if (preg_match('/^[\w_\s-]*[\w_-]+/u', $identifier)) { + if (preg_match('/^[\w\s-]*[\w-]+/u', $identifier)) { return $this->_startQuote . $identifier . $this->_endQuote; } @@ -128,7 +128,7 @@ public function queryTranslator(string $type): Closure * and values a method in this class. * * @psalm-return array - * @return string[] + * @return array */ protected function _expressionTranslators(): array { diff --git a/app/vendor/cakephp/cakephp/src/Database/Driver/Sqlite.php b/app/vendor/cakephp/cakephp/src/Database/Driver/Sqlite.php index d81748e5..0b2cdb0c 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Driver/Sqlite.php +++ b/app/vendor/cakephp/cakephp/src/Database/Driver/Sqlite.php @@ -43,7 +43,7 @@ class Sqlite extends Driver * * - `mask` The mask used for created database * - * @var array + * @var array */ protected $_baseConfig = [ 'persistent' => false, @@ -64,7 +64,7 @@ class Sqlite extends Driver protected $_schemaDialect; /** - * Whether or not the connected server supports window functions. + * Whether the connected server supports window functions. * * @var bool|null */ @@ -87,7 +87,7 @@ class Sqlite extends Driver /** * Mapping of date parts. * - * @var array + * @var array */ protected $_dateParts = [ 'day' => 'd', @@ -99,6 +99,16 @@ class Sqlite extends Driver 'year' => 'Y', ]; + /** + * Mapping of feature to db server version for feature availability checks. + * + * @var array + */ + protected $featureVersions = [ + 'cte' => '3.8.3', + 'window' => '3.28.0', + ]; + /** * Establishes a connection to the database server * @@ -115,7 +125,7 @@ public function connect(): bool PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, ]; - if (!is_string($config['database']) || !strlen($config['database'])) { + if (!is_string($config['database']) || $config['database'] === '') { $name = $config['name'] ?? 'unknown'; throw new InvalidArgumentException( "The `database` key for the `{$name}` SQLite connection needs to be a non-empty string." @@ -155,7 +165,7 @@ public function enabled(): bool /** * Prepares a sql statement to be executed * - * @param string|\Cake\Database\Query $query The query to prepare. + * @param \Cake\Database\Query|string $query The query to prepare. * @return \Cake\Database\StatementInterface */ public function prepare($query): StatementInterface @@ -192,6 +202,27 @@ public function enableForeignKeySQL(): string return 'PRAGMA foreign_keys = ON'; } + /** + * @inheritDoc + */ + public function supports(string $feature): bool + { + switch ($feature) { + case static::FEATURE_CTE: + case static::FEATURE_WINDOW: + return version_compare( + $this->version(), + $this->featureVersions[$feature], + '>=' + ); + + case static::FEATURE_TRUNCATE_WITH_CONSTRAINTS: + return true; + } + + return parent::supports($feature); + } + /** * @inheritDoc */ @@ -308,27 +339,25 @@ protected function _transformFunctionExpression(FunctionExpression $expression): * Returns true if the server supports common table expressions. * * @return bool + * @deprecated 4.3.0 Use `supports(DriverInterface::FEATURE_CTE)` instead */ public function supportsCTEs(): bool { - if ($this->supportsCTEs === null) { - $this->supportsCTEs = version_compare($this->version(), '3.8.3', '>='); - } + deprecationWarning('Feature support checks are now implemented by `supports()` with FEATURE_* constants.'); - return $this->supportsCTEs; + return $this->supports(static::FEATURE_CTE); } /** * Returns true if the connected server supports window functions. * * @return bool + * @deprecated 4.3.0 Use `supports(DriverInterface::FEATURE_WINDOW)` instead */ public function supportsWindowFunctions(): bool { - if ($this->_supportsWindowFunctions === null) { - $this->_supportsWindowFunctions = version_compare($this->version(), '3.25.0', '>='); - } + deprecationWarning('Feature support checks are now implemented by `supports()` with FEATURE_* constants.'); - return $this->_supportsWindowFunctions; + return $this->supports(static::FEATURE_WINDOW); } } diff --git a/app/vendor/cakephp/cakephp/src/Database/Driver/Sqlserver.php b/app/vendor/cakephp/cakephp/src/Database/Driver/Sqlserver.php index 3a655537..23e23dd2 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Driver/Sqlserver.php +++ b/app/vendor/cakephp/cakephp/src/Database/Driver/Sqlserver.php @@ -56,7 +56,7 @@ class Sqlserver extends Driver /** * Base configuration settings for Sqlserver driver * - * @var array + * @var array */ protected $_baseConfig = [ 'host' => 'localhost\SQLEXPRESS', @@ -98,11 +98,6 @@ class Sqlserver extends Driver */ protected $_endQuote = ']'; - /** - * @inheritDoc - */ - protected $supportsCTEs = true; - /** * Establishes a connection to the database server. * @@ -191,7 +186,7 @@ public function enabled(): bool /** * Prepares a sql statement to be executed * - * @param string|\Cake\Database\Query $query The query to prepare. + * @param \Cake\Database\Query|string $query The query to prepare. * @return \Cake\Database\StatementInterface */ public function prepare($query): StatementInterface @@ -238,7 +233,8 @@ public function savePointSQL($name): string */ public function releaseSavePointSQL($name): string { - return 'COMMIT TRANSACTION t' . $name; + // SQLServer has no release save point operation. + return ''; } /** @@ -265,6 +261,26 @@ public function enableForeignKeySQL(): string return 'EXEC sp_MSforeachtable "ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all"'; } + /** + * @inheritDoc + */ + public function supports(string $feature): bool + { + switch ($feature) { + case static::FEATURE_CTE: + case static::FEATURE_TRUNCATE_WITH_CONSTRAINTS: + case static::FEATURE_WINDOW: + return true; + + case static::FEATURE_QUOTE: + $this->connect(); + + return $this->_connection->getAttribute(PDO::ATTR_DRIVER_NAME) !== 'odbc'; + } + + return parent::supports($feature); + } + /** * @inheritDoc */ diff --git a/app/vendor/cakephp/cakephp/src/Database/Driver/TupleComparisonTranslatorTrait.php b/app/vendor/cakephp/cakephp/src/Database/Driver/TupleComparisonTranslatorTrait.php index c3cf72fc..e94b268b 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Driver/TupleComparisonTranslatorTrait.php +++ b/app/vendor/cakephp/cakephp/src/Database/Driver/TupleComparisonTranslatorTrait.php @@ -20,6 +20,7 @@ use Cake\Database\Expression\QueryExpression; use Cake\Database\Expression\TupleComparison; use Cake\Database\Query; +use RuntimeException; /** * Provides a translator method for tuple comparisons @@ -55,14 +56,23 @@ protected function _transformTupleComparison(TupleComparison $expression, Query return; } + $operator = strtoupper($expression->getOperator()); + if (!in_array($operator, ['IN', '='])) { + throw new RuntimeException( + sprintf( + 'Tuple comparison transform only supports the `IN` and `=` operators, `%s` given.', + $operator + ) + ); + } + $value = $expression->getValue(); - $op = $expression->getOperator(); $true = new QueryExpression('1'); if ($value instanceof Query) { $selected = array_values($value->clause('select')); foreach ($fields as $i => $field) { - $value->andWhere([$field . " $op" => new IdentifierExpression($selected[$i])]); + $value->andWhere([$field => new IdentifierExpression($selected[$i])]); } $value->select($true, true); $expression->setField($true); @@ -73,7 +83,8 @@ protected function _transformTupleComparison(TupleComparison $expression, Query $type = $expression->getType(); if ($type) { - $typeMap = array_combine($fields, $type); + /** @var array $typeMap */ + $typeMap = array_combine($fields, $type) ?: []; } else { $typeMap = []; } diff --git a/app/vendor/cakephp/cakephp/src/Database/DriverInterface.php b/app/vendor/cakephp/cakephp/src/Database/DriverInterface.php index 5587b795..e2ccc4d3 100644 --- a/app/vendor/cakephp/cakephp/src/Database/DriverInterface.php +++ b/app/vendor/cakephp/cakephp/src/Database/DriverInterface.php @@ -25,9 +25,60 @@ * * @method int|null getMaxAliasLength() Returns the maximum alias length allowed. * @method int getConnectRetries() Returns the number of connection retry attempts made. + * @method bool supports(string $feature) Checks whether a feature is supported by the driver. + * @method bool inTransaction() Returns whether a transaction is active. */ interface DriverInterface { + /** + * Common Table Expressions (with clause) support. + * + * @var string + */ + public const FEATURE_CTE = 'cte'; + + /** + * Disabling constraints without being in transaction support. + * + * @var string + */ + public const FEATURE_DISABLE_CONSTRAINT_WITHOUT_TRANSACTION = 'disable-constraint-without-transaction'; + + /** + * Native JSON data type support. + * + * @var string + */ + public const FEATURE_JSON = 'json'; + + /** + * PDO::quote() support. + * + * @var string + */ + public const FEATURE_QUOTE = 'quote'; + + /** + * Transaction savepoint support. + * + * @var string + */ + public const FEATURE_SAVEPOINT = 'savepoint'; + + /** + * Truncate with foreign keys attached support. + * + * @var string + */ + public const FEATURE_TRUNCATE_WITH_CONSTRAINTS = 'truncate-with-constraints'; + + /** + * Window function support (all or partial clauses). + * + * @var string + */ + public const FEATURE_WINDOW = 'window'; + /** * Establishes a connection to the database server. * @@ -68,7 +119,7 @@ public function enabled(): bool; /** * Prepares a sql statement to be executed. * - * @param string|\Cake\Database\Query $query The query to turn into a prepared statement. + * @param \Cake\Database\Query|string $query The query to turn into a prepared statement. * @return \Cake\Database\StatementInterface */ public function prepare($query): StatementInterface; @@ -137,6 +188,7 @@ public function enableForeignKeySQL(): string; * to already created tables. * * @return bool True if driver supports dynamic constraints. + * @deprecated 4.3.0 Fixtures no longer dynamically drop and create constraints. */ public function supportsDynamicConstraints(): bool; @@ -144,6 +196,7 @@ public function supportsDynamicConstraints(): bool; * Returns whether this driver supports save points for nested transactions. * * @return bool True if save points are supported, false otherwise. + * @deprecated 4.3.0 Use `supports(DriverInterface::FEATURE_SAVEPOINT)` instead */ public function supportsSavePoints(): bool; @@ -160,6 +213,7 @@ public function quote($value, $type): string; * Checks if the driver supports quoting. * * @return bool + * @deprecated 4.3.0 Use `supports(DriverInterface::FEATURE_QUOTE)` instead */ public function supportsQuoting(): bool; @@ -177,7 +231,7 @@ public function queryTranslator(string $type): Closure; /** * Get the schema dialect. * - * Used by Cake\Database\Schema package to reflect schema and + * Used by {@link \Cake\Database\Schema} package to reflect schema and * generate schema. * * If all the tables that use this Driver specify their @@ -221,14 +275,14 @@ public function schema(): string; public function lastInsertId(?string $table = null, ?string $column = null); /** - * Checks whether or not the driver is connected. + * Checks whether the driver is connected. * * @return bool */ public function isConnected(): bool; /** - * Sets whether or not this driver should automatically quote identifiers + * Sets whether this driver should automatically quote identifiers * in queries. * * @param bool $enable Whether to enable auto quoting @@ -244,7 +298,7 @@ public function enableAutoQuoting(bool $enable = true); public function disableAutoQuoting(); /** - * Returns whether or not this driver should automatically quote identifiers + * Returns whether this driver should automatically quote identifiers * in queries. * * @return bool diff --git a/app/vendor/cakephp/cakephp/src/Database/Exception/MissingExtensionException.php b/app/vendor/cakephp/cakephp/src/Database/Exception/MissingExtensionException.php index 63380a2f..794e0844 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Exception/MissingExtensionException.php +++ b/app/vendor/cakephp/cakephp/src/Database/Exception/MissingExtensionException.php @@ -27,5 +27,5 @@ class MissingExtensionException extends CakeException * @inheritDoc */ // phpcs:ignore Generic.Files.LineLength - protected $_messageTemplate = 'Database driver %s cannot be used due to a missing PHP extension or unmet dependency'; + protected $_messageTemplate = 'Database driver %s cannot be used due to a missing PHP extension or unmet dependency. Requested by connection "%s"'; } diff --git a/app/vendor/cakephp/cakephp/src/Database/Expression/AggregateExpression.php b/app/vendor/cakephp/cakephp/src/Database/Expression/AggregateExpression.php index 02d5caf3..842a7700 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Expression/AggregateExpression.php +++ b/app/vendor/cakephp/cakephp/src/Database/Expression/AggregateExpression.php @@ -20,7 +20,7 @@ use Closure; /** - * This represents a SQL aggregate function expression in a SQL statement. + * This represents an SQL aggregate function expression in an SQL statement. * Calls can be constructed by passing the name of the function and a list of params. * For security reasons, all params passed are quoted by default unless * explicitly told otherwise. @@ -41,8 +41,8 @@ class AggregateExpression extends FunctionExpression implements WindowInterface * Adds conditions to the FILTER clause. The conditions are the same format as * `Query::where()`. * - * @param string|array|\Cake\Database\ExpressionInterface|\Closure $conditions The conditions to filter on. - * @param array $types associative array of type names used to bind values to query + * @param \Cake\Database\ExpressionInterface|\Closure|array|string $conditions The conditions to filter on. + * @param array $types Associative array of type names used to bind values to query * @return $this * @see \Cake\Database\Query::where() */ diff --git a/app/vendor/cakephp/cakephp/src/Database/Expression/BetweenExpression.php b/app/vendor/cakephp/cakephp/src/Database/Expression/BetweenExpression.php index 34b7a1ee..34661478 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Expression/BetweenExpression.php +++ b/app/vendor/cakephp/cakephp/src/Database/Expression/BetweenExpression.php @@ -53,7 +53,7 @@ class BetweenExpression implements ExpressionInterface, FieldInterface /** * Constructor * - * @param string|\Cake\Database\ExpressionInterface $field The field name to compare for values inbetween the range. + * @param \Cake\Database\ExpressionInterface|string $field The field name to compare for values inbetween the range. * @param mixed $from The initial value of the range. * @param mixed $to The ending value in the comparison range. * @param string|null $type The data type name to bind the values with. @@ -81,7 +81,7 @@ public function sql(ValueBinder $binder): string 'to' => $this->_to, ]; - /** @var string|\Cake\Database\ExpressionInterface $field */ + /** @var \Cake\Database\ExpressionInterface|string $field */ $field = $this->_field; if ($field instanceof ExpressionInterface) { $field = $field->sql($binder); diff --git a/app/vendor/cakephp/cakephp/src/Database/Expression/CaseExpression.php b/app/vendor/cakephp/cakephp/src/Database/Expression/CaseExpression.php index d8c6ebe1..864a3bcc 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Expression/CaseExpression.php +++ b/app/vendor/cakephp/cakephp/src/Database/Expression/CaseExpression.php @@ -23,6 +23,8 @@ /** * This class represents a SQL Case statement + * + * @deprecated 4.3.0 Use QueryExpression::case() or CaseStatementExpression instead */ class CaseExpression implements ExpressionInterface { @@ -47,28 +49,32 @@ class CaseExpression implements ExpressionInterface /** * The `ELSE` value for the case statement. If null then no `ELSE` will be included. * - * @var string|\Cake\Database\ExpressionInterface|array|null + * @var \Cake\Database\ExpressionInterface|array|string|null */ protected $_elseValue; /** * Constructs the case expression * - * @param array|\Cake\Database\ExpressionInterface $conditions The conditions to test. Must be a ExpressionInterface + * @param \Cake\Database\ExpressionInterface|array $conditions The conditions to test. Must be a ExpressionInterface * instance, or an array of ExpressionInterface instances. - * @param array|\Cake\Database\ExpressionInterface $values associative array of values to be associated with the + * @param \Cake\Database\ExpressionInterface|array $values Associative array of values to be associated with the * conditions passed in $conditions. If there are more $values than $conditions, * the last $value is used as the `ELSE` value. - * @param array $types associative array of types to be associated with the values + * @param array $types Associative array of types to be associated with the values * passed in $values */ public function __construct($conditions = [], $values = [], $types = []) { + $conditions = is_array($conditions) ? $conditions : [$conditions]; + $values = is_array($values) ? $values : [$values]; + $types = is_array($types) ? $types : [$types]; + if (!empty($conditions)) { $this->add($conditions, $values, $types); } - if (is_array($conditions) && is_array($values) && count($values) > count($conditions)) { + if (count($values) > count($conditions)) { end($values); $key = key($values); $this->elseValue($values[$key], $types[$key] ?? null); @@ -80,23 +86,17 @@ public function __construct($conditions = [], $values = [], $types = []) * Conditions must be a one dimensional array or a QueryExpression. * The trueValues must be a similar structure, but may contain a string value. * - * @param array|\Cake\Database\ExpressionInterface $conditions Must be a ExpressionInterface instance, + * @param \Cake\Database\ExpressionInterface|array $conditions Must be a ExpressionInterface instance, * or an array of ExpressionInterface instances. - * @param array|\Cake\Database\ExpressionInterface $values associative array of values of each condition - * @param array $types associative array of types to be associated with the values + * @param \Cake\Database\ExpressionInterface|array $values Associative array of values of each condition + * @param array $types Associative array of types to be associated with the values * @return $this */ public function add($conditions = [], $values = [], $types = []) { - if (!is_array($conditions)) { - $conditions = [$conditions]; - } - if (!is_array($values)) { - $values = [$values]; - } - if (!is_array($types)) { - $types = [$types]; - } + $conditions = is_array($conditions) ? $conditions : [$conditions]; + $values = is_array($values) ? $values : [$values]; + $types = is_array($types) ? $types : [$types]; $this->_addExpressions($conditions, $values, $types); @@ -108,8 +108,8 @@ public function add($conditions = [], $values = [], $types = []) * If no matching true value, then it is defaulted to '1'. * * @param array $conditions Array of ExpressionInterface instances. - * @param array $values associative array of values of each condition - * @param array $types associative array of types to be associated with the values + * @param array $values Associative array of values of each condition + * @param array $types Associative array of types to be associated with the values * @return void */ protected function _addExpressions(array $conditions, array $values, array $types): void @@ -138,7 +138,9 @@ protected function _addExpressions(array $conditions, array $values, array $type } if ($value === 'identifier') { - $value = new IdentifierExpression($keyValues[$k]); + /** @var string $identifier */ + $identifier = $keyValues[$k]; + $value = new IdentifierExpression($identifier); $this->_values[] = $value; continue; } @@ -161,7 +163,7 @@ protected function _addExpressions(array $conditions, array $values, array $type /** * Sets the default value * - * @param \Cake\Database\ExpressionInterface|string|array|null $value Value to set + * @param \Cake\Database\ExpressionInterface|array|string|null $value Value to set * @param string|null $type Type of value * @return void */ @@ -186,7 +188,7 @@ public function elseValue($value = null, ?string $type = null): void /** * Compiles the relevant parts into sql * - * @param array|string|\Cake\Database\ExpressionInterface $part The part to compile + * @param \Cake\Database\ExpressionInterface|array|string $part The part to compile * @param \Cake\Database\ValueBinder $binder Sql generator * @return string */ diff --git a/app/vendor/cakephp/cakephp/src/Database/Expression/CommonTableExpression.php b/app/vendor/cakephp/cakephp/src/Database/Expression/CommonTableExpression.php index d2a38cad..f3d359ee 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Expression/CommonTableExpression.php +++ b/app/vendor/cakephp/cakephp/src/Database/Expression/CommonTableExpression.php @@ -36,7 +36,7 @@ class CommonTableExpression implements ExpressionInterface /** * The field names to use for the CTE. * - * @var \Cake\Database\Expression\IdentifierExpression[] + * @var array<\Cake\Database\Expression\IdentifierExpression> */ protected $fields = []; @@ -65,7 +65,7 @@ class CommonTableExpression implements ExpressionInterface * Constructor. * * @param string $name The CTE name. - * @param \Closure|\Cake\Database\ExpressionInterface $query CTE query + * @param \Cake\Database\ExpressionInterface|\Closure $query CTE query */ public function __construct(string $name = '', $query = null) { @@ -94,7 +94,7 @@ public function name(string $name) /** * Sets the query for this CTE. * - * @param \Closure|\Cake\Database\ExpressionInterface $query CTE query + * @param \Cake\Database\ExpressionInterface|\Closure $query CTE query * @return $this */ public function query($query) @@ -115,7 +115,7 @@ public function query($query) /** * Adds one or more fields (arguments) to the CTE. * - * @param string|string[]|\Cake\Database\Expression\IdentifierExpression|\Cake\Database\Expression\IdentifierExpression[] $fields Field names + * @param \Cake\Database\Expression\IdentifierExpression|array<\Cake\Database\Expression\IdentifierExpression>|array|string $fields Field names * @return $this */ public function field($fields) diff --git a/app/vendor/cakephp/cakephp/src/Database/Expression/ComparisonExpression.php b/app/vendor/cakephp/cakephp/src/Database/Expression/ComparisonExpression.php index 2eba1dee..ea0eddc0 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Expression/ComparisonExpression.php +++ b/app/vendor/cakephp/cakephp/src/Database/Expression/ComparisonExpression.php @@ -54,7 +54,7 @@ class ComparisonExpression implements ExpressionInterface, FieldInterface protected $_operator = '='; /** - * Whether or not the value in this expression is a traversable + * Whether the value in this expression is a traversable * * @var bool */ @@ -64,14 +64,14 @@ class ComparisonExpression implements ExpressionInterface, FieldInterface * A cached list of ExpressionInterface objects that were * found in the value for this expression. * - * @var \Cake\Database\ExpressionInterface[] + * @var array<\Cake\Database\ExpressionInterface> */ protected $_valueExpressions = []; /** * Constructor * - * @param string|\Cake\Database\ExpressionInterface $field the field name to compare to a value + * @param \Cake\Database\ExpressionInterface|string $field the field name to compare to a value * @param mixed $value The value to be used in comparison * @param string|null $type the type name used to cast the value * @param string $operator the operator used for comparing field and value @@ -139,14 +139,17 @@ public function getOperator(): string */ public function sql(ValueBinder $binder): string { - /** @var string|\Cake\Database\ExpressionInterface $field */ + /** @var \Cake\Database\ExpressionInterface|string $field */ $field = $this->_field; if ($field instanceof ExpressionInterface) { $field = $field->sql($binder); } - if ($this->_value instanceof ExpressionInterface) { + if ($this->_value instanceof IdentifierExpression) { + $template = '%s %s %s'; + $value = $this->_value->sql($binder); + } elseif ($this->_value instanceof ExpressionInterface) { $template = '%s %s (%s)'; $value = $this->_value->sql($binder); } else { @@ -206,7 +209,7 @@ protected function _stringExpression(ValueBinder $binder): array { $template = '%s '; - if ($this->_field instanceof ExpressionInterface) { + if ($this->_field instanceof ExpressionInterface && !$this->_field instanceof IdentifierExpression) { $template = '(%s) '; } @@ -282,7 +285,7 @@ protected function _flattenValue(iterable $value, ValueBinder $binder, ?string $ * and all ExpressionInterface objects that could be found in the second * position. * - * @param iterable|\Cake\Database\ExpressionInterface $values The rows to insert + * @param \Cake\Database\ExpressionInterface|iterable $values The rows to insert * @return array */ protected function _collectExpressions($values): array diff --git a/app/vendor/cakephp/cakephp/src/Database/Expression/FieldInterface.php b/app/vendor/cakephp/cakephp/src/Database/Expression/FieldInterface.php index 24b7204f..f0554d97 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Expression/FieldInterface.php +++ b/app/vendor/cakephp/cakephp/src/Database/Expression/FieldInterface.php @@ -25,7 +25,7 @@ interface FieldInterface /** * Sets the field name * - * @param string|array|\Cake\Database\ExpressionInterface $field The field to compare with. + * @param \Cake\Database\ExpressionInterface|array|string $field The field to compare with. * @return void */ public function setField($field): void; @@ -33,7 +33,7 @@ public function setField($field): void; /** * Returns the field name * - * @return string|array|\Cake\Database\ExpressionInterface + * @return \Cake\Database\ExpressionInterface|array|string */ public function getField(); } diff --git a/app/vendor/cakephp/cakephp/src/Database/Expression/FieldTrait.php b/app/vendor/cakephp/cakephp/src/Database/Expression/FieldTrait.php index 8e12bec6..0614a8eb 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Expression/FieldTrait.php +++ b/app/vendor/cakephp/cakephp/src/Database/Expression/FieldTrait.php @@ -24,14 +24,14 @@ trait FieldTrait /** * The field name or expression to be used in the left hand side of the operator * - * @var string|array|\Cake\Database\ExpressionInterface + * @var \Cake\Database\ExpressionInterface|array|string */ protected $_field; /** * Sets the field name * - * @param string|array|\Cake\Database\ExpressionInterface $field The field to compare with. + * @param \Cake\Database\ExpressionInterface|array|string $field The field to compare with. * @return void */ public function setField($field): void @@ -42,7 +42,7 @@ public function setField($field): void /** * Returns the field name * - * @return string|array|\Cake\Database\ExpressionInterface + * @return \Cake\Database\ExpressionInterface|array|string */ public function getField() { diff --git a/app/vendor/cakephp/cakephp/src/Database/Expression/FunctionExpression.php b/app/vendor/cakephp/cakephp/src/Database/Expression/FunctionExpression.php index 217e1ebd..105655ba 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Expression/FunctionExpression.php +++ b/app/vendor/cakephp/cakephp/src/Database/Expression/FunctionExpression.php @@ -62,7 +62,7 @@ class FunctionExpression extends QueryExpression implements TypedResultInterface * @param string $name the name of the function to be constructed * @param array $params list of arguments to be passed to the function * If associative the key would be used as argument when value is 'literal' - * @param array $types associative array of types to be associated with the + * @param array|array $types Associative array of types to be associated with the * passed arguments * @param string $returnType The return type of this expression */ @@ -101,7 +101,7 @@ public function getName(): string * * @param array $conditions list of arguments to be passed to the function * If associative the key would be used as argument when value is 'literal' - * @param array $types associative array of types to be associated with the + * @param array $types Associative array of types to be associated with the * passed arguments * @param bool $prepend Whether to prepend or append to the list of arguments * @see \Cake\Database\Expression\FunctionExpression::__construct() for more details. diff --git a/app/vendor/cakephp/cakephp/src/Database/Expression/OrderByExpression.php b/app/vendor/cakephp/cakephp/src/Database/Expression/OrderByExpression.php index dd738114..74fbf219 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Expression/OrderByExpression.php +++ b/app/vendor/cakephp/cakephp/src/Database/Expression/OrderByExpression.php @@ -28,8 +28,8 @@ class OrderByExpression extends QueryExpression /** * Constructor * - * @param string|array|\Cake\Database\ExpressionInterface $conditions The sort columns - * @param array|\Cake\Database\TypeMap $types The types for each column. + * @param \Cake\Database\ExpressionInterface|array|string $conditions The sort columns + * @param \Cake\Database\TypeMap|array $types The types for each column. * @param string $conjunction The glue used to join conditions together. */ public function __construct($conditions = [], $types = [], $conjunction = '') diff --git a/app/vendor/cakephp/cakephp/src/Database/Expression/OrderClauseExpression.php b/app/vendor/cakephp/cakephp/src/Database/Expression/OrderClauseExpression.php index 5e7b8405..dfab8b97 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Expression/OrderClauseExpression.php +++ b/app/vendor/cakephp/cakephp/src/Database/Expression/OrderClauseExpression.php @@ -52,7 +52,7 @@ public function __construct($field, $direction) */ public function sql(ValueBinder $binder): string { - /** @var string|\Cake\Database\ExpressionInterface $field */ + /** @var \Cake\Database\ExpressionInterface|string $field */ $field = $this->_field; if ($field instanceof Query) { $field = sprintf('(%s)', $field->sql($binder)); diff --git a/app/vendor/cakephp/cakephp/src/Database/Expression/QueryExpression.php b/app/vendor/cakephp/cakephp/src/Database/Expression/QueryExpression.php index 3f3ec4ff..2ab13d21 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Expression/QueryExpression.php +++ b/app/vendor/cakephp/cakephp/src/Database/Expression/QueryExpression.php @@ -56,9 +56,9 @@ class QueryExpression implements ExpressionInterface, Countable * expression objects. Optionally, you can set the conjunction keyword to be used * for joining each part of this level of the expression tree. * - * @param string|array|\Cake\Database\ExpressionInterface $conditions Tree like array structure + * @param \Cake\Database\ExpressionInterface|array|string $conditions Tree like array structure * containing all the conditions to be added or nested inside this expression object. - * @param array|\Cake\Database\TypeMap $types associative array of types to be associated with the values + * @param \Cake\Database\TypeMap|array $types Associative array of types to be associated with the values * passed in $conditions. * @param string $conjunction the glue that will join all the string conditions at this * level of the expression tree. For example "AND", "OR", "XOR"... @@ -107,11 +107,11 @@ public function getConjunction(): string * then it will cause the placeholder to be re-written dynamically so if the * value is an array, it will create as many placeholders as values are in it. * - * @param string|array|\Cake\Database\ExpressionInterface $conditions single or multiple conditions to + * @param \Cake\Database\ExpressionInterface|array|string $conditions single or multiple conditions to * be added. When using an array and the key is 'OR' or 'AND' a new expression * object will be created with that conjunction and internal array value passed * as conditions. - * @param array $types associative array of fields pointing to the type of the + * @param array $types Associative array of fields pointing to the type of the * values that are being passed. Used for correctly binding values to statements. * @see \Cake\Database\Query::where() for examples on conditions * @return $this @@ -138,7 +138,7 @@ public function add($conditions, array $types = []) /** * Adds a new condition to the expression object in the form "field = value". * - * @param string|\Cake\Database\ExpressionInterface $field Database field to be compared against value + * @param \Cake\Database\ExpressionInterface|string $field Database field to be compared against value * @param mixed $value The value to be bound to $field for comparison * @param string|null $type the type name for $value as configured using the Type map. * If it is suffixed with "[]" and the value is an array then multiple placeholders @@ -157,7 +157,7 @@ public function eq($field, $value, ?string $type = null) /** * Adds a new condition to the expression object in the form "field != value". * - * @param string|\Cake\Database\ExpressionInterface $field Database field to be compared against value + * @param \Cake\Database\ExpressionInterface|string $field Database field to be compared against value * @param mixed $value The value to be bound to $field for comparison * @param string|null $type the type name for $value as configured using the Type map. * If it is suffixed with "[]" and the value is an array then multiple placeholders @@ -176,7 +176,7 @@ public function notEq($field, $value, $type = null) /** * Adds a new condition to the expression object in the form "field > value". * - * @param string|\Cake\Database\ExpressionInterface $field Database field to be compared against value + * @param \Cake\Database\ExpressionInterface|string $field Database field to be compared against value * @param mixed $value The value to be bound to $field for comparison * @param string|null $type the type name for $value as configured using the Type map. * @return $this @@ -193,7 +193,7 @@ public function gt($field, $value, $type = null) /** * Adds a new condition to the expression object in the form "field < value". * - * @param string|\Cake\Database\ExpressionInterface $field Database field to be compared against value + * @param \Cake\Database\ExpressionInterface|string $field Database field to be compared against value * @param mixed $value The value to be bound to $field for comparison * @param string|null $type the type name for $value as configured using the Type map. * @return $this @@ -210,7 +210,7 @@ public function lt($field, $value, $type = null) /** * Adds a new condition to the expression object in the form "field >= value". * - * @param string|\Cake\Database\ExpressionInterface $field Database field to be compared against value + * @param \Cake\Database\ExpressionInterface|string $field Database field to be compared against value * @param mixed $value The value to be bound to $field for comparison * @param string|null $type the type name for $value as configured using the Type map. * @return $this @@ -227,7 +227,7 @@ public function gte($field, $value, $type = null) /** * Adds a new condition to the expression object in the form "field <= value". * - * @param string|\Cake\Database\ExpressionInterface $field Database field to be compared against value + * @param \Cake\Database\ExpressionInterface|string $field Database field to be compared against value * @param mixed $value The value to be bound to $field for comparison * @param string|null $type the type name for $value as configured using the Type map. * @return $this @@ -244,7 +244,7 @@ public function lte($field, $value, $type = null) /** * Adds a new condition to the expression object in the form "field IS NULL". * - * @param string|\Cake\Database\ExpressionInterface $field database field to be + * @param \Cake\Database\ExpressionInterface|string $field database field to be * tested for null * @return $this */ @@ -260,7 +260,7 @@ public function isNull($field) /** * Adds a new condition to the expression object in the form "field IS NOT NULL". * - * @param string|\Cake\Database\ExpressionInterface $field database field to be + * @param \Cake\Database\ExpressionInterface|string $field database field to be * tested for not null * @return $this */ @@ -276,7 +276,7 @@ public function isNotNull($field) /** * Adds a new condition to the expression object in the form "field LIKE value". * - * @param string|\Cake\Database\ExpressionInterface $field Database field to be compared against value + * @param \Cake\Database\ExpressionInterface|string $field Database field to be compared against value * @param mixed $value The value to be bound to $field for comparison * @param string|null $type the type name for $value as configured using the Type map. * @return $this @@ -293,7 +293,7 @@ public function like($field, $value, $type = null) /** * Adds a new condition to the expression object in the form "field NOT LIKE value". * - * @param string|\Cake\Database\ExpressionInterface $field Database field to be compared against value + * @param \Cake\Database\ExpressionInterface|string $field Database field to be compared against value * @param mixed $value The value to be bound to $field for comparison * @param string|null $type the type name for $value as configured using the Type map. * @return $this @@ -311,8 +311,8 @@ public function notLike($field, $value, $type = null) * Adds a new condition to the expression object in the form * "field IN (value1, value2)". * - * @param string|\Cake\Database\ExpressionInterface $field Database field to be compared against value - * @param string|array|\Cake\Database\ExpressionInterface $values the value to be bound to $field for comparison + * @param \Cake\Database\ExpressionInterface|string $field Database field to be compared against value + * @param \Cake\Database\ExpressionInterface|array|string $values the value to be bound to $field for comparison * @param string|null $type the type name for $value as configured using the Type map. * @return $this */ @@ -331,26 +331,61 @@ public function in($field, $values, $type = null) /** * Adds a new case expression to the expression object * - * @param array|\Cake\Database\ExpressionInterface $conditions The conditions to test. Must be a ExpressionInterface + * @param \Cake\Database\ExpressionInterface|array $conditions The conditions to test. Must be a ExpressionInterface * instance, or an array of ExpressionInterface instances. - * @param array|\Cake\Database\ExpressionInterface $values associative array of values to be associated with the + * @param \Cake\Database\ExpressionInterface|array $values Associative array of values to be associated with the * conditions passed in $conditions. If there are more $values than $conditions, * the last $value is used as the `ELSE` value. - * @param array $types associative array of types to be associated with the values + * @param array $types Associative array of types to be associated with the values * passed in $values * @return $this + * @deprecated 4.3.0 Use QueryExpression::case() or CaseStatementExpression instead */ public function addCase($conditions, $values = [], $types = []) { + deprecationWarning('QueryExpression::addCase() is deprecated, use case() instead.'); + return $this->add(new CaseExpression($conditions, $values, $types)); } + /** + * Returns a new case expression object. + * + * When a value is set, the syntax generated is + * `CASE case_value WHEN when_value ... END` (simple case), + * where the `when_value`'s are compared against the + * `case_value`. + * + * When no value is set, the syntax generated is + * `CASE WHEN when_conditions ... END` (searched case), + * where the conditions hold the comparisons. + * + * Note that `null` is a valid case value, and thus should + * only be passed if you actually want to create the simple + * case expression variant! + * + * @param \Cake\Database\ExpressionInterface|object|scalar|null $value The case value. + * @param string|null $type The case value type. If no type is provided, the type will be tried to be inferred + * from the value. + * @return \Cake\Database\Expression\CaseStatementExpression + */ + public function case($value = null, ?string $type = null): CaseStatementExpression + { + if (func_num_args() > 0) { + $expression = new CaseStatementExpression($value, $type); + } else { + $expression = new CaseStatementExpression(); + } + + return $expression->setTypeMap($this->getTypeMap()); + } + /** * Adds a new condition to the expression object in the form * "field NOT IN (value1, value2)". * - * @param string|\Cake\Database\ExpressionInterface $field Database field to be compared against value - * @param string|array|\Cake\Database\ExpressionInterface $values the value to be bound to $field for comparison + * @param \Cake\Database\ExpressionInterface|string $field Database field to be compared against value + * @param \Cake\Database\ExpressionInterface|array|string $values the value to be bound to $field for comparison * @param string|null $type the type name for $value as configured using the Type map. * @return $this */ @@ -366,6 +401,25 @@ public function notIn($field, $values, $type = null) return $this->add(new ComparisonExpression($field, $values, $type, 'NOT IN')); } + /** + * Adds a new condition to the expression object in the form + * "(field NOT IN (value1, value2) OR field IS NULL". + * + * @param \Cake\Database\ExpressionInterface|string $field Database field to be compared against value + * @param \Cake\Database\ExpressionInterface|array|string $values the value to be bound to $field for comparison + * @param string|null $type the type name for $value as configured using the Type map. + * @return $this + */ + public function notInOrNull($field, $values, ?string $type = null) + { + $or = new static([], [], 'OR'); + $or + ->notIn($field, $values, $type) + ->isNull($field); + + return $this->add($or); + } + /** * Adds a new condition to the expression object in the form "EXISTS (...)". * @@ -392,7 +446,7 @@ public function notExists(ExpressionInterface $expression) * Adds a new condition to the expression object in the form * "field BETWEEN from AND to". * - * @param string|\Cake\Database\ExpressionInterface $field The field name to compare for values inbetween the range. + * @param \Cake\Database\ExpressionInterface|string $field The field name to compare for values inbetween the range. * @param mixed $from The initial value of the range. * @param mixed $to The ending value in the comparison range. * @param string|null $type the type name for $value as configured using the Type map. @@ -411,8 +465,8 @@ public function between($field, $from, $to, $type = null) * Returns a new QueryExpression object containing all the conditions passed * and set up the conjunction to be "AND" * - * @param \Closure|string|array|\Cake\Database\ExpressionInterface $conditions to be joined with AND - * @param array $types associative array of fields pointing to the type of the + * @param \Cake\Database\ExpressionInterface|\Closure|array|string $conditions to be joined with AND + * @param array $types Associative array of fields pointing to the type of the * values that are being passed. Used for correctly binding values to statements. * @return \Cake\Database\Expression\QueryExpression */ @@ -429,8 +483,8 @@ public function and($conditions, $types = []) * Returns a new QueryExpression object containing all the conditions passed * and set up the conjunction to be "OR" * - * @param \Closure|string|array|\Cake\Database\ExpressionInterface $conditions to be joined with OR - * @param array $types associative array of fields pointing to the type of the + * @param \Cake\Database\ExpressionInterface|\Closure|array|string $conditions to be joined with OR + * @param array $types Associative array of fields pointing to the type of the * values that are being passed. Used for correctly binding values to statements. * @return \Cake\Database\Expression\QueryExpression */ @@ -449,8 +503,8 @@ public function or($conditions, $types = []) * Returns a new QueryExpression object containing all the conditions passed * and set up the conjunction to be "AND" * - * @param \Closure|string|array|\Cake\Database\ExpressionInterface $conditions to be joined with AND - * @param array $types associative array of fields pointing to the type of the + * @param \Cake\Database\ExpressionInterface|\Closure|array|string $conditions to be joined with AND + * @param array $types Associative array of fields pointing to the type of the * values that are being passed. Used for correctly binding values to statements. * @return \Cake\Database\Expression\QueryExpression * @deprecated 4.0.0 Use {@link and()} instead. @@ -466,8 +520,8 @@ public function and_($conditions, $types = []) * Returns a new QueryExpression object containing all the conditions passed * and set up the conjunction to be "OR" * - * @param \Closure|string|array|\Cake\Database\ExpressionInterface $conditions to be joined with OR - * @param array $types associative array of fields pointing to the type of the + * @param \Cake\Database\ExpressionInterface|\Closure|array|string $conditions to be joined with OR + * @param array $types Associative array of fields pointing to the type of the * values that are being passed. Used for correctly binding values to statements. * @return \Cake\Database\Expression\QueryExpression * @deprecated 4.0.0 Use {@link or()} instead. @@ -487,8 +541,8 @@ public function or_($conditions, $types = []) * "NOT ( (condition1) AND (conditions2) )" conjunction depends on the one * currently configured for this object. * - * @param string|array|\Closure|\Cake\Database\ExpressionInterface $conditions to be added and negated - * @param array $types associative array of fields pointing to the type of the + * @param \Cake\Database\ExpressionInterface|\Closure|array|string $conditions to be added and negated + * @param array $types Associative array of fields pointing to the type of the * values that are being passed. Used for correctly binding values to statements. * @return $this */ @@ -547,7 +601,7 @@ public function sql(ValueBinder $binder): string } elseif ($part instanceof ExpressionInterface) { $part = $part->sql($binder); } - if (strlen($part)) { + if ($part !== '') { $parts[] = $part; } } @@ -601,13 +655,13 @@ public function iterateParts(callable $callback) } /** - * Check whether or not a callable is acceptable. + * Check whether a callable is acceptable. * * We don't accept ['class', 'method'] style callbacks, * as they often contain user input and arrays of strings * are easy to sneak in. * - * @param callable|string|array|\Cake\Database\ExpressionInterface $callable The callable to check. + * @param \Cake\Database\ExpressionInterface|callable|array|string $callable The callable to check. * @return bool Valid callable. * @deprecated 4.2.0 This method is unused. * @codeCoverageIgnore @@ -648,7 +702,7 @@ public function hasNestedExpression(): bool * representation is wrapped around an adequate instance or of this class. * * @param array $conditions list of conditions to be stored in this object - * @param array $types list of types associated on fields referenced in $conditions + * @param array $types list of types associated on fields referenced in $conditions * @return void */ protected function _addConditions(array $conditions, array $types): void @@ -717,7 +771,7 @@ protected function _addConditions(array $conditions, array $types): void * @param string $field The value from which the actual field and operator will * be extracted. * @param mixed $value The value to be bound to a placeholder for the field - * @return string|\Cake\Database\ExpressionInterface + * @return \Cake\Database\ExpressionInterface * @throws \InvalidArgumentException If operator is invalid or missing on NULL usage. */ protected function _parseCondition(string $field, $value) @@ -727,21 +781,24 @@ protected function _parseCondition(string $field, $value) $expression = $field; $spaces = substr_count($field, ' '); - // Handle operators with a space in them like `is not` and `not like` + // Handle field values that contain multiple spaces, such as + // operators with a space in them like `field IS NOT` and + // `field NOT LIKE`, or combinations with function expressions + // like `CONCAT(first_name, ' ', last_name) IN`. if ($spaces > 1) { $parts = explode(' ', $field); if (preg_match('/(is not|not \w+)$/i', $field)) { $last = array_pop($parts); $second = array_pop($parts); - array_push($parts, strtolower("{$second} {$last}")); + $parts[] = "{$second} {$last}"; } $operator = array_pop($parts); $expression = implode(' ', $parts); } elseif ($spaces == 1) { $parts = explode(' ', $field, 2); [$expression, $operator] = $parts; - $operator = strtolower(trim($operator)); } + $operator = strtolower(trim($operator)); $type = $this->getTypeMap()->type($expression); $typeMultiple = (is_string($type) && strpos($type, '[]') !== false); @@ -795,7 +852,7 @@ protected function _parseCondition(string $field, $value) /** * Returns the type name for the passed field if it was stored in the typeMap * - * @param string|\Cake\Database\ExpressionInterface $field The field name to get a type for. + * @param \Cake\Database\ExpressionInterface|string $field The field name to get a type for. * @return string|null The computed type or null, if the type is unknown. */ protected function _calculateType($field): ?string diff --git a/app/vendor/cakephp/cakephp/src/Database/Expression/TupleComparison.php b/app/vendor/cakephp/cakephp/src/Database/Expression/TupleComparison.php index 8896e337..b5c36f07 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Expression/TupleComparison.php +++ b/app/vendor/cakephp/cakephp/src/Database/Expression/TupleComparison.php @@ -19,6 +19,7 @@ use Cake\Database\ExpressionInterface; use Cake\Database\ValueBinder; use Closure; +use InvalidArgumentException; /** * This expression represents SQL fragments that are used for comparing one tuple @@ -37,8 +38,8 @@ class TupleComparison extends ComparisonExpression /** * Constructor * - * @param string|array|\Cake\Database\ExpressionInterface $fields the fields to use to form a tuple - * @param array|\Cake\Database\ExpressionInterface $values the values to use to form a tuple + * @param \Cake\Database\ExpressionInterface|array|string $fields the fields to use to form a tuple + * @param \Cake\Database\ExpressionInterface|array $values the values to use to form a tuple * @param array $types the types names to use for casting each of the values, only * one type per position in the value array in needed * @param string $conjunction the operator used for comparing field and value @@ -47,8 +48,8 @@ public function __construct($fields, $values, array $types = [], string $conjunc { $this->_type = $types; $this->setField($fields); - $this->setValue($values); $this->_operator = $conjunction; + $this->setValue($values); } /** @@ -69,6 +70,20 @@ public function getType(): array */ public function setValue($value): void { + if ($this->isMulti()) { + if (is_array($value) && !is_array(current($value))) { + throw new InvalidArgumentException( + 'Multi-tuple comparisons require a multi-tuple value, single-tuple given.' + ); + } + } else { + if (is_array($value) && is_array(current($value))) { + throw new InvalidArgumentException( + 'Single-tuple comparisons require a single-tuple value, multi-tuple given.' + ); + } + } + $this->_value = $value; } @@ -160,7 +175,7 @@ protected function _bindValue($value, ValueBinder $binder, ?string $type = null) */ public function traverse(Closure $callback) { - /** @var string[] $fields */ + /** @var array $fields */ $fields = $this->getField(); foreach ($fields as $field) { $this->_traverseValue($field, $callback); diff --git a/app/vendor/cakephp/cakephp/src/Database/Expression/ValuesExpression.php b/app/vendor/cakephp/cakephp/src/Database/Expression/ValuesExpression.php index 8219de36..68dbf25c 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Expression/ValuesExpression.php +++ b/app/vendor/cakephp/cakephp/src/Database/Expression/ValuesExpression.php @@ -58,7 +58,7 @@ class ValuesExpression implements ExpressionInterface protected $_query; /** - * Whether or not values have been casted to expressions + * Whether values have been casted to expressions * already. * * @var bool @@ -80,7 +80,7 @@ public function __construct(array $columns, TypeMap $typeMap) /** * Add a row of data to be inserted. * - * @param array|\Cake\Database\Query $values Array of data to append into the insert, or + * @param \Cake\Database\Query|array $values Array of data to append into the insert, or * a query for doing INSERT INTO .. SELECT style commands * @return void * @throws \Cake\Database\Exception\DatabaseException When mixing array + Query data types. diff --git a/app/vendor/cakephp/cakephp/src/Database/Expression/WindowExpression.php b/app/vendor/cakephp/cakephp/src/Database/Expression/WindowExpression.php index cfbf53c1..3604be4b 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Expression/WindowExpression.php +++ b/app/vendor/cakephp/cakephp/src/Database/Expression/WindowExpression.php @@ -31,7 +31,7 @@ class WindowExpression implements ExpressionInterface, WindowInterface protected $name; /** - * @var \Cake\Database\ExpressionInterface[] + * @var array<\Cake\Database\ExpressionInterface> */ protected $partitions = []; @@ -296,7 +296,7 @@ public function traverse(Closure $callback) * Builds frame offset sql. * * @param \Cake\Database\ValueBinder $binder Value binder - * @param int|string|\Cake\Database\ExpressionInterface|null $offset Frame offset + * @param \Cake\Database\ExpressionInterface|string|int|null $offset Frame offset * @param string $direction Frame offset direction * @return string */ diff --git a/app/vendor/cakephp/cakephp/src/Database/Expression/WindowInterface.php b/app/vendor/cakephp/cakephp/src/Database/Expression/WindowInterface.php index 03e117ac..7a7bac57 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Expression/WindowInterface.php +++ b/app/vendor/cakephp/cakephp/src/Database/Expression/WindowInterface.php @@ -49,7 +49,7 @@ interface WindowInterface /** * Adds one or more partition expressions to the window. * - * @param \Closure|(\Cake\Database\ExpressionInterface|string)[]|\Cake\Database\ExpressionInterface|string $partitions Partition expressions + * @param \Cake\Database\ExpressionInterface|\Closure|array<\Cake\Database\ExpressionInterface|string>|string $partitions Partition expressions * @return $this */ public function partition($partitions); @@ -57,7 +57,7 @@ public function partition($partitions); /** * Adds one or more order clauses to the window. * - * @param \Closure|(\Cake\Database\ExpressionInterface|string)[]|\Cake\Database\ExpressionInterface|string $fields Order expressions + * @param \Cake\Database\ExpressionInterface|\Closure|array<\Cake\Database\ExpressionInterface|string>|string $fields Order expressions * @return $this */ public function order($fields); @@ -78,8 +78,8 @@ public function order($fields); * If you need to use 'FOLLOWING' with frame start or * 'PRECEDING' with frame end, use `frame()` instead. * - * @param int|string|\Cake\Database\ExpressionInterface|null $start Frame start - * @param int|string|\Cake\Database\ExpressionInterface|null $end Frame end + * @param \Cake\Database\ExpressionInterface|string|int|null $start Frame start + * @param \Cake\Database\ExpressionInterface|string|int|null $end Frame end * If not passed in, only frame start SQL will be generated. * @return $this */ @@ -122,9 +122,9 @@ public function groups(?int $start, ?int $end = 0); * - `null` - 'UNBOUNDED' * * @param string $type Frame type - * @param int|string|\Cake\Database\ExpressionInterface|null $startOffset Frame start offset + * @param \Cake\Database\ExpressionInterface|string|int|null $startOffset Frame start offset * @param string $startDirection Frame start direction - * @param int|string|\Cake\Database\ExpressionInterface|null $endOffset Frame end offset + * @param \Cake\Database\ExpressionInterface|string|int|null $endOffset Frame end offset * @param string $endDirection Frame end direction * @return $this * @throws \InvalidArgumentException WHen offsets are negative. diff --git a/app/vendor/cakephp/cakephp/src/Database/FieldTypeConverter.php b/app/vendor/cakephp/cakephp/src/Database/FieldTypeConverter.php index 12a23262..ff7f39f6 100644 --- a/app/vendor/cakephp/cakephp/src/Database/FieldTypeConverter.php +++ b/app/vendor/cakephp/cakephp/src/Database/FieldTypeConverter.php @@ -29,7 +29,7 @@ class FieldTypeConverter * An array containing the name of the fields and the Type objects * each should use when converting them. * - * @var \Cake\Database\TypeInterface[] + * @var array<\Cake\Database\TypeInterface> */ protected $_typeMap; @@ -37,7 +37,7 @@ class FieldTypeConverter * An array containing the name of the fields and the Type objects * each should use when converting them using batching. * - * @var array + * @var array */ protected $batchingTypeMap; @@ -46,7 +46,7 @@ class FieldTypeConverter * at the moment this object is created. Used so that the types list * is not fetched on each single row of the results. * - * @var \Cake\Database\TypeInterface[]|\Cake\Database\Type\BatchCastingInterface[] + * @var array<\Cake\Database\TypeInterface|\Cake\Database\Type\BatchCastingInterface> */ protected $types; diff --git a/app/vendor/cakephp/cakephp/src/Database/FunctionsBuilder.php b/app/vendor/cakephp/cakephp/src/Database/FunctionsBuilder.php index 5a5c0f29..1251fcad 100644 --- a/app/vendor/cakephp/cakephp/src/Database/FunctionsBuilder.php +++ b/app/vendor/cakephp/cakephp/src/Database/FunctionsBuilder.php @@ -40,7 +40,7 @@ public function rand(): FunctionExpression /** * Returns a AggregateExpression representing a call to SQL SUM function. * - * @param string|\Cake\Database\ExpressionInterface $expression the function argument + * @param \Cake\Database\ExpressionInterface|string $expression the function argument * @param array $types list of types to bind to the arguments * @return \Cake\Database\Expression\AggregateExpression */ @@ -57,7 +57,7 @@ public function sum($expression, $types = []): AggregateExpression /** * Returns a AggregateExpression representing a call to SQL AVG function. * - * @param string|\Cake\Database\ExpressionInterface $expression the function argument + * @param \Cake\Database\ExpressionInterface|string $expression the function argument * @param array $types list of types to bind to the arguments * @return \Cake\Database\Expression\AggregateExpression */ @@ -69,7 +69,7 @@ public function avg($expression, $types = []): AggregateExpression /** * Returns a AggregateExpression representing a call to SQL MAX function. * - * @param string|\Cake\Database\ExpressionInterface $expression the function argument + * @param \Cake\Database\ExpressionInterface|string $expression the function argument * @param array $types list of types to bind to the arguments * @return \Cake\Database\Expression\AggregateExpression */ @@ -81,7 +81,7 @@ public function max($expression, $types = []): AggregateExpression /** * Returns a AggregateExpression representing a call to SQL MIN function. * - * @param string|\Cake\Database\ExpressionInterface $expression the function argument + * @param \Cake\Database\ExpressionInterface|string $expression the function argument * @param array $types list of types to bind to the arguments * @return \Cake\Database\Expression\AggregateExpression */ @@ -93,7 +93,7 @@ public function min($expression, $types = []): AggregateExpression /** * Returns a AggregateExpression representing a call to SQL COUNT function. * - * @param string|\Cake\Database\ExpressionInterface $expression the function argument + * @param \Cake\Database\ExpressionInterface|string $expression the function argument * @param array $types list of types to bind to the arguments * @return \Cake\Database\Expression\AggregateExpression */ @@ -132,7 +132,7 @@ public function coalesce(array $args, array $types = []): FunctionExpression * The `$type` parameter is a SQL type. The return type for the returned expression * is the default type name. Use `setReturnType()` to update it. * - * @param string|\Cake\Database\ExpressionInterface $field Field or expression to cast. + * @param \Cake\Database\ExpressionInterface|string $field Field or expression to cast. * @param string $type The SQL data type * @return \Cake\Database\Expression\FunctionExpression */ @@ -174,7 +174,7 @@ public function dateDiff(array $args, array $types = []): FunctionExpression * Returns the specified date part from the SQL expression. * * @param string $part Part of the date to return. - * @param string|\Cake\Database\ExpressionInterface $expression Expression to obtain the date part from. + * @param \Cake\Database\ExpressionInterface|string $expression Expression to obtain the date part from. * @param array $types list of types to bind to the arguments * @return \Cake\Database\Expression\FunctionExpression */ @@ -187,7 +187,7 @@ public function datePart(string $part, $expression, array $types = []): Function * Returns the specified date part from the SQL expression. * * @param string $part Part of the date to return. - * @param string|\Cake\Database\ExpressionInterface $expression Expression to obtain the date part from. + * @param \Cake\Database\ExpressionInterface|string $expression Expression to obtain the date part from. * @param array $types list of types to bind to the arguments * @return \Cake\Database\Expression\FunctionExpression */ @@ -202,7 +202,7 @@ public function extract(string $part, $expression, array $types = []): FunctionE /** * Add the time unit to the date expression * - * @param string|\Cake\Database\ExpressionInterface $expression Expression to obtain the date part from. + * @param \Cake\Database\ExpressionInterface|string $expression Expression to obtain the date part from. * @param string|int $value Value to be added. Use negative to subtract. * @param string $unit Unit of the value e.g. hour or day. * @param array $types list of types to bind to the arguments @@ -224,7 +224,7 @@ public function dateAdd($expression, $value, string $unit, array $types = []): F * Returns a FunctionExpression representing a call to SQL WEEKDAY function. * 1 - Sunday, 2 - Monday, 3 - Tuesday... * - * @param string|\Cake\Database\ExpressionInterface $expression the function argument + * @param \Cake\Database\ExpressionInterface|string $expression the function argument * @param array $types list of types to bind to the arguments * @return \Cake\Database\Expression\FunctionExpression */ @@ -237,7 +237,7 @@ public function dayOfWeek($expression, $types = []): FunctionExpression * Returns a FunctionExpression representing a call to SQL WEEKDAY function. * 1 - Sunday, 2 - Monday, 3 - Tuesday... * - * @param string|\Cake\Database\ExpressionInterface $expression the function argument + * @param \Cake\Database\ExpressionInterface|string $expression the function argument * @param array $types list of types to bind to the arguments * @return \Cake\Database\Expression\FunctionExpression */ @@ -362,7 +362,7 @@ public function __call(string $name, array $args): FunctionExpression * Creates function parameter array from expression or string literal. * * @param \Cake\Database\ExpressionInterface|string $expression function argument - * @return (\Cake\Database\ExpressionInterface|string)[] + * @return array<\Cake\Database\ExpressionInterface|string> */ protected function toLiteralParam($expression) { diff --git a/app/vendor/cakephp/cakephp/src/Database/Log/LoggedQuery.php b/app/vendor/cakephp/cakephp/src/Database/Log/LoggedQuery.php index bc014ee8..6560a367 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Log/LoggedQuery.php +++ b/app/vendor/cakephp/cakephp/src/Database/Log/LoggedQuery.php @@ -16,6 +16,7 @@ */ namespace Cake\Database\Log; +use Cake\Database\Driver\Sqlserver; use JsonSerializable; /** @@ -26,6 +27,13 @@ */ class LoggedQuery implements JsonSerializable { + /** + * Driver executing the query + * + * @var \Cake\Database\DriverInterface|null + */ + public $driver = null; + /** * Query string that was executed * @@ -73,8 +81,13 @@ protected function interpolate(): string if ($p === null) { return 'NULL'; } + if (is_bool($p)) { - return $p ? '1' : '0'; + if ($this->driver instanceof Sqlserver) { + return $p ? '1' : '0'; + } + + return $p ? 'TRUE' : 'FALSE'; } if (is_string($p)) { @@ -110,7 +123,7 @@ protected function interpolate(): string /** * Get the logging context data for a query. * - * @return array + * @return array */ public function getContext(): array { @@ -123,7 +136,7 @@ public function getContext(): array /** * Returns data that will be serialized as JSON * - * @return array + * @return array */ public function jsonSerialize(): array { diff --git a/app/vendor/cakephp/cakephp/src/Database/Log/LoggingStatement.php b/app/vendor/cakephp/cakephp/src/Database/Log/LoggingStatement.php index 581a2cb0..22814e39 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Log/LoggingStatement.php +++ b/app/vendor/cakephp/cakephp/src/Database/Log/LoggingStatement.php @@ -37,7 +37,7 @@ class LoggingStatement extends StatementDecorator /** * Holds bound params * - * @var array + * @var array */ protected $_compiledParams = []; @@ -68,6 +68,7 @@ public function execute(?array $params = null): bool $this->startTime = microtime(true); $this->loggedQuery = new LoggedQuery(); + $this->loggedQuery->driver = $this->_driver; $this->loggedQuery->params = $params ?: $this->_compiledParams; try { diff --git a/app/vendor/cakephp/cakephp/src/Database/Log/QueryLogger.php b/app/vendor/cakephp/cakephp/src/Database/Log/QueryLogger.php index 04040889..b6957d1a 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Log/QueryLogger.php +++ b/app/vendor/cakephp/cakephp/src/Database/Log/QueryLogger.php @@ -30,7 +30,7 @@ class QueryLogger extends BaseLog /** * Constructor. * - * @param array $config Configuration array + * @param array $config Configuration array */ public function __construct(array $config = []) { diff --git a/app/vendor/cakephp/cakephp/src/Database/Query.php b/app/vendor/cakephp/cakephp/src/Database/Query.php index 030decae..3df66cd5 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Query.php +++ b/app/vendor/cakephp/cakephp/src/Database/Query.php @@ -72,7 +72,7 @@ class Query implements ExpressionInterface, IteratorAggregate /** * List of SQL parts that will be used to build this query. * - * @var array + * @var array */ protected $_parts = [ 'delete' => true, @@ -100,7 +100,7 @@ class Query implements ExpressionInterface, IteratorAggregate /** * The list of query clauses to traverse for generating a SELECT statement * - * @var string[] + * @var array */ protected $_selectParts = [ 'with', 'select', 'from', 'join', 'where', 'group', 'having', 'order', 'limit', @@ -110,21 +110,21 @@ class Query implements ExpressionInterface, IteratorAggregate /** * The list of query clauses to traverse for generating an UPDATE statement * - * @var string[] + * @var array */ protected $_updateParts = ['with', 'update', 'set', 'where', 'epilog']; /** * The list of query clauses to traverse for generating a DELETE statement * - * @var string[] + * @var array */ protected $_deleteParts = ['with', 'delete', 'modifier', 'from', 'where', 'epilog']; /** * The list of query clauses to traverse for generating an INSERT statement * - * @var string[] + * @var array */ protected $_insertParts = ['with', 'insert', 'values', 'epilog']; @@ -142,7 +142,7 @@ class Query implements ExpressionInterface, IteratorAggregate * statement upon retrieval. Each one of the callback function will receive * the row array as first argument. * - * @var callable[] + * @var array */ protected $_resultDecorators = []; @@ -169,7 +169,7 @@ class Query implements ExpressionInterface, IteratorAggregate protected $_functionsBuilder; /** - * Boolean for tracking whether or not buffered results + * Boolean for tracking whether buffered results * are enabled. * * @var bool @@ -361,7 +361,7 @@ public function traverse($callback) * ``` * * @param callable $visitor A function or callable to be executed for each part - * @param string[] $parts The list of query parts to traverse + * @param array $parts The list of query parts to traverse * @return $this */ public function traverseParts(callable $visitor, array $parts) @@ -412,7 +412,7 @@ public function traverseParts(callable $visitor, array $parts) * }); * ``` * - * @param \Closure|\Cake\Database\Expression\CommonTableExpression $cte The CTE to add. + * @param \Cake\Database\Expression\CommonTableExpression|\Closure $cte The CTE to add. * @param bool $overwrite Whether to reset the list of CTEs. * @return $this */ @@ -469,7 +469,7 @@ public function with($cte, bool $overwrite = false) * fields you should also call `Cake\ORM\Query::enableAutoFields()` to select the default fields * from the table. * - * @param array|\Cake\Database\ExpressionInterface|string|callable $fields fields to be added to the list. + * @param \Cake\Database\ExpressionInterface|callable|array|string $fields fields to be added to the list. * @param bool $overwrite whether to reset fields with passed list or not * @return $this */ @@ -518,7 +518,7 @@ public function select($fields = [], bool $overwrite = false) * $query->distinct('name', true); * ``` * - * @param array|\Cake\Database\ExpressionInterface|string|bool $on Enable/disable distinct class + * @param \Cake\Database\ExpressionInterface|array|string|bool $on Enable/disable distinct class * or list of fields to be filtered on * @param bool $overwrite whether to reset fields with passed list or not * @return $this @@ -563,7 +563,7 @@ public function distinct($on = [], $overwrite = false) * // It will produce the SQL: SELECT HIGH_PRIORITY SQL_NO_CACHE name, city FROM products * ``` * - * @param array|\Cake\Database\ExpressionInterface|string $modifiers modifiers to be applied to the query + * @param \Cake\Database\ExpressionInterface|array|string $modifiers modifiers to be applied to the query * @param bool $overwrite whether to reset order with field list or not * @return $this */ @@ -573,7 +573,10 @@ public function modifier($modifiers, $overwrite = false) if ($overwrite) { $this->_parts['modifier'] = []; } - $this->_parts['modifier'] = array_merge($this->_parts['modifier'], (array)$modifiers); + if (!is_array($modifiers)) { + $modifiers = [$modifiers]; + } + $this->_parts['modifier'] = array_merge($this->_parts['modifier'], $modifiers); return $this; } @@ -702,8 +705,8 @@ public function from($tables = [], $overwrite = false) * $query->join(['something' => 'different_table'], [], true); // resets joins list * ``` * - * @param array|string $tables list of tables to be joined in the query - * @param array $types associative array of type names used to bind values to query + * @param array|string $tables list of tables to be joined in the query + * @param array $types Associative array of type names used to bind values to query * @param bool $overwrite whether to reset joins with passed list or not * @see \Cake\Database\TypeFactory * @return $this @@ -790,8 +793,8 @@ public function removeJoin(string $name) * * See `join()` for further details on conditions and types. * - * @param string|string[] $table The table to join with - * @param string|array|\Cake\Database\ExpressionInterface $conditions The conditions + * @param array|string $table The table to join with + * @param \Cake\Database\ExpressionInterface|array|string $conditions The conditions * to use for joining. * @param array $types a list of types associated to the conditions used for converting * values to the corresponding database representation. @@ -812,8 +815,8 @@ public function leftJoin($table, $conditions = [], $types = []) * The arguments of this method are identical to the `leftJoin()` shorthand, please refer * to that methods description for further details. * - * @param string|string[] $table The table to join with - * @param string|array|\Cake\Database\ExpressionInterface $conditions The conditions + * @param array|string $table The table to join with + * @param \Cake\Database\ExpressionInterface|array|string $conditions The conditions * to use for joining. * @param array $types a list of types associated to the conditions used for converting * values to the corresponding database representation. @@ -832,12 +835,12 @@ public function rightJoin($table, $conditions = [], $types = []) * This is a shorthand method for building joins via `join()`. * * The arguments of this method are identical to the `leftJoin()` shorthand, please refer - * to that methods description for further details. + * to that method's description for further details. * - * @param string|array $table The table to join with - * @param string|array|\Cake\Database\ExpressionInterface $conditions The conditions + * @param array|string $table The table to join with + * @param \Cake\Database\ExpressionInterface|array|string $conditions The conditions * to use for joining. - * @param array $types a list of types associated to the conditions used for converting + * @param array $types a list of types associated to the conditions used for converting * values to the corresponding database representation. * @return $this */ @@ -851,8 +854,8 @@ public function innerJoin($table, $conditions = [], $types = []) /** * Returns an array that can be passed to the join method describing a single join clause * - * @param string|string[] $table The table to join with - * @param string|array|\Cake\Database\ExpressionInterface $conditions The conditions + * @param array|string $table The table to join with + * @param \Cake\Database\ExpressionInterface|array|string $conditions The conditions * to use for joining. * @param string $type the join type to use * @return array @@ -993,8 +996,8 @@ protected function _makeJoin($table, $conditions, $type): array * If you use string conditions make sure that your values are correctly quoted. * The safest thing you can do is to never use string conditions. * - * @param string|array|\Cake\Database\ExpressionInterface|\Closure|null $conditions The conditions to filter on. - * @param array $types associative array of type names used to bind values to query + * @param \Cake\Database\ExpressionInterface|\Closure|array|string|null $conditions The conditions to filter on. + * @param array $types Associative array of type names used to bind values to query * @param bool $overwrite whether to reset conditions with passed list or not * @see \Cake\Database\TypeFactory * @see \Cake\Database\Expression\QueryExpression @@ -1013,7 +1016,7 @@ public function where($conditions = null, array $types = [], bool $overwrite = f /** * Convenience method that adds a NOT NULL condition to the query * - * @param array|string|\Cake\Database\ExpressionInterface $fields A single field or expressions or a list of them + * @param \Cake\Database\ExpressionInterface|array|string $fields A single field or expressions or a list of them * that should be not null. * @return $this */ @@ -1035,7 +1038,7 @@ public function whereNotNull($fields) /** * Convenience method that adds a IS NULL condition to the query * - * @param array|string|\Cake\Database\ExpressionInterface $fields A single field or expressions or a list of them + * @param \Cake\Database\ExpressionInterface|array|string $fields A single field or expressions or a list of them * that should be null. * @return $this */ @@ -1069,7 +1072,7 @@ public function whereNull($fields) * * @param string $field Field * @param array $values Array of values - * @param array $options Options + * @param array $options Options * @return $this */ public function whereInList(string $field, array $values, array $options = []) @@ -1096,7 +1099,7 @@ public function whereInList(string $field, array $values, array $options = []) * * @param string $field Field * @param array $values Array of values - * @param array $options Options + * @param array $options Options * @return $this */ public function whereNotInList(string $field, array $values, array $options = []) @@ -1113,6 +1116,39 @@ public function whereNotInList(string $field, array $values, array $options = [] return $this->where([$field . ' NOT IN' => $values], $options['types']); } + /** + * Adds a NOT IN condition or set of conditions to be used in the WHERE clause for this + * query. This also allows the field to be null with a IS NULL condition since the null + * value would cause the NOT IN condition to always fail. + * + * This method does allow empty inputs in contrast to where() if you set + * 'allowEmpty' to true. + * Be careful about using it without proper sanity checks. + * + * @param string $field Field + * @param array $values Array of values + * @param array $options Options + * @return $this + */ + public function whereNotInListOrNull(string $field, array $values, array $options = []) + { + $options += [ + 'types' => [], + 'allowEmpty' => false, + ]; + + if ($options['allowEmpty'] && !$values) { + return $this->where([$field . ' IS NOT' => null]); + } + + return $this->where( + [ + 'OR' => [$field . ' NOT IN' => $values, $field . ' IS' => null], + ], + $options['types'] + ); + } + /** * Connects any previously defined set of conditions to the provided list * using the AND operator. This function accepts the conditions list in the same @@ -1163,8 +1199,8 @@ public function whereNotInList(string $field, array $values, array $options = [] * * `WHERE (title = 'Foo') AND (author_id = 1 OR author_id = 2)` * - * @param string|array|\Cake\Database\ExpressionInterface|\Closure $conditions The conditions to add with AND. - * @param array $types associative array of type names used to bind values to query + * @param \Cake\Database\ExpressionInterface|\Closure|array|string $conditions The conditions to add with AND. + * @param array $types Associative array of type names used to bind values to query * @see \Cake\Database\Query::where() * @see \Cake\Database\TypeFactory * @return $this @@ -1233,7 +1269,7 @@ public function andWhere($conditions, array $types = []) * If you need to set complex expressions as order conditions, you * should use `orderAsc()` or `orderDesc()`. * - * @param array|\Cake\Database\ExpressionInterface|\Closure|string $fields fields to be added to the list + * @param \Cake\Database\ExpressionInterface|\Closure|array|string $fields fields to be added to the list * @param bool $overwrite whether to reset order with field list or not * @return $this */ @@ -1264,8 +1300,8 @@ public function order($fields, $overwrite = false) * Order fields are not suitable for use with user supplied data as they are * not sanitized by the query builder. * - * @param string|\Cake\Database\Expression\QueryExpression|\Closure $field The field to order on. - * @param bool $overwrite Whether or not to reset the order clauses. + * @param \Cake\Database\ExpressionInterface|\Closure|string $field The field to order on. + * @param bool $overwrite Whether to reset the order clauses. * @return $this */ public function orderAsc($field, $overwrite = false) @@ -1298,8 +1334,8 @@ public function orderAsc($field, $overwrite = false) * Order fields are not suitable for use with user supplied data as they are * not sanitized by the query builder. * - * @param string|\Cake\Database\Expression\QueryExpression|\Closure $field The field to order on. - * @param bool $overwrite Whether or not to reset the order clauses. + * @param \Cake\Database\ExpressionInterface|\Closure|string $field The field to order on. + * @param bool $overwrite Whether to reset the order clauses. * @return $this */ public function orderDesc($field, $overwrite = false) @@ -1344,7 +1380,7 @@ public function orderDesc($field, $overwrite = false) * Group fields are not suitable for use with user supplied data as they are * not sanitized by the query builder. * - * @param array|\Cake\Database\ExpressionInterface|string $fields fields to be added to the list + * @param \Cake\Database\ExpressionInterface|array|string $fields fields to be added to the list * @param bool $overwrite whether to reset fields with passed list or not * @return $this */ @@ -1373,8 +1409,8 @@ public function group($fields, $overwrite = false) * Having fields are not suitable for use with user supplied data as they are * not sanitized by the query builder. * - * @param string|array|\Cake\Database\ExpressionInterface|\Closure|null $conditions The having conditions. - * @param array $types associative array of type names used to bind values to query + * @param \Cake\Database\ExpressionInterface|\Closure|array|string|null $conditions The having conditions. + * @param array $types Associative array of type names used to bind values to query * @param bool $overwrite whether to reset conditions with passed list or not * @see \Cake\Database\Query::where() * @return $this @@ -1398,8 +1434,8 @@ public function having($conditions = null, $types = [], $overwrite = false) * Having fields are not suitable for use with user supplied data as they are * not sanitized by the query builder. * - * @param string|array|\Cake\Database\ExpressionInterface|\Closure $conditions The AND conditions for HAVING. - * @param array $types associative array of type names used to bind values to query + * @param \Cake\Database\ExpressionInterface|\Closure|array|string $conditions The AND conditions for HAVING. + * @param array $types Associative array of type names used to bind values to query * @see \Cake\Database\Query::andWhere() * @return $this */ @@ -1489,13 +1525,13 @@ public function page(int $num, ?int $limit = null) * $query->limit($query->newExpr()->add(['1 + 1'])); // LIMIT (1 + 1) * ``` * - * @param int|\Cake\Database\ExpressionInterface|null $num number of records to be returned + * @param \Cake\Database\ExpressionInterface|int|null $limit number of records to be returned * @return $this */ - public function limit($num) + public function limit($limit) { $this->_dirty(); - $this->_parts['limit'] = $num; + $this->_parts['limit'] = $limit; return $this; } @@ -1515,13 +1551,13 @@ public function limit($num) * $query->offset($query->newExpr()->add(['1 + 1'])); // OFFSET (1 + 1) * ``` * - * @param int|\Cake\Database\ExpressionInterface|null $num number of records to be skipped + * @param \Cake\Database\ExpressionInterface|int|null $offset number of records to be skipped * @return $this */ - public function offset($num) + public function offset($offset) { $this->_dirty(); - $this->_parts['offset'] = $num; + $this->_parts['offset'] = $offset; return $this; } @@ -1546,7 +1582,7 @@ public function offset($num) * * `SELECT id, name FROM things d UNION SELECT id, title FROM articles a` * - * @param string|\Cake\Database\Query $query full SQL query to be used in UNION operator + * @param \Cake\Database\Query|string $query full SQL query to be used in UNION operator * @param bool $overwrite whether to reset the list of queries to be operated or not * @return $this */ @@ -1581,7 +1617,7 @@ public function union($query, $overwrite = false) * * `SELECT id, name FROM things d UNION ALL SELECT id, title FROM articles a` * - * @param string|\Cake\Database\Query $query full SQL query to be used in UNION operator + * @param \Cake\Database\Query|string $query full SQL query to be used in UNION operator * @param bool $overwrite whether to reset the list of queries to be operated or not * @return $this */ @@ -1606,7 +1642,7 @@ public function unionAll($query, $overwrite = false) * with Query::values(). * * @param array $columns The columns to insert into. - * @param string[] $types A map between columns & their datatypes. + * @param array $types A map between columns & their datatypes. * @return $this * @throws \RuntimeException When there are 0 columns. */ @@ -1670,7 +1706,7 @@ public function identifier(string $identifier): ExpressionInterface * or by providing an array of value sets. Additionally $data can be a Query * instance to insert data from another SELECT statement. * - * @param array|\Cake\Database\Query|\Cake\Database\Expression\ValuesExpression $data The data to insert. + * @param \Cake\Database\Expression\ValuesExpression|\Cake\Database\Query|array $data The data to insert. * @return $this * @throws \Cake\Database\Exception\DatabaseException if you try to set values before declaring columns. * Or if you try to set values on non-insert queries. @@ -1705,7 +1741,7 @@ public function values($data) * * Can be combined with set() and where() methods to create update queries. * - * @param string|\Cake\Database\ExpressionInterface $table The table you want to update. + * @param \Cake\Database\ExpressionInterface|string $table The table you want to update. * @return $this */ public function update($table) @@ -1748,13 +1784,13 @@ public function update($table) * }); * ``` * - * @param string|array|\Closure|\Cake\Database\Expression\QueryExpression $key The column name or array of keys + * @param \Cake\Database\Expression\QueryExpression|\Closure|array|string $key The column name or array of keys * + values to set. This can also be a QueryExpression containing a SQL fragment. * It can also be a Closure, that is required to return an expression object. * @param mixed $value The value to update $key to. Can be null if $key is an * array or QueryExpression. When $key is an array, this parameter will be * used as $types instead. - * @param array|string $types The column types to treat data as. + * @param array|string $types The column types to treat data as. * @return $this */ public function set($key, $value = null, $types = []) @@ -1819,7 +1855,7 @@ public function delete(?string $table = null) * * Epliog content is raw SQL and not suitable for use with user supplied data. * - * @param string|\Cake\Database\ExpressionInterface|null $expression The expression to be appended + * @param \Cake\Database\ExpressionInterface|string|null $expression The expression to be appended * @return $this */ public function epilog($expression = null) @@ -1854,7 +1890,7 @@ public function type(): string * $expression = $query->newExpr('Table.column = Table2.column'); // Return a raw SQL expression * ``` * - * @param string|array|\Cake\Database\ExpressionInterface|null $rawExpression A string, array or anything you want wrapped in an expression object + * @param \Cake\Database\ExpressionInterface|array|string|null $rawExpression A string, array or anything you want wrapped in an expression object * @return \Cake\Database\Expression\QueryExpression */ public function newExpr($rawExpression = null): QueryExpression @@ -1899,6 +1935,7 @@ public function func(): FunctionsBuilder * @return \Cake\Database\StatementInterface * @psalm-suppress ImplementedReturnTypeMismatch */ + #[\ReturnTypeWillChange] public function getIterator() { if ($this->_iterator === null || $this->_dirty) { @@ -1975,7 +2012,7 @@ public function clause(string $name) * ``` * * @param callable|null $callback The callback to invoke when results are fetched. - * @param bool $overwrite Whether or not this should append or replace all existing decorators. + * @param bool $overwrite Whether this should append or replace all existing decorators. * @return $this */ public function decorateResults(?callable $callback, bool $overwrite = false) @@ -2019,7 +2056,7 @@ public function traverseExpressions(callable $callback) /** * Query parts traversal method used by traverseExpressions() * - * @param \Cake\Database\ExpressionInterface|\Cake\Database\ExpressionInterface[] $expression Query expression or + * @param \Cake\Database\ExpressionInterface|array<\Cake\Database\ExpressionInterface> $expression Query expression or * array of expressions. * @param \Closure $callback The callback to be executed for each ExpressionInterface * found inside this query. @@ -2112,7 +2149,7 @@ public function setValueBinder(?ValueBinder $binder) * When disabled it will consume less memory as fetched results are not * remembered for future iterations. * - * @param bool $enable Whether or not to enable buffering + * @param bool $enable Whether to enable buffering * @return $this */ public function enableBufferedResults(bool $enable = true) @@ -2261,10 +2298,10 @@ protected function _decorateStatement(StatementInterface $statement) * Helper function used to build conditions by composing QueryExpression objects. * * @param string $part Name of the query part to append the new part to - * @param string|array|\Cake\Database\ExpressionInterface|\Closure|null $append Expression or builder function to append. + * @param \Cake\Database\ExpressionInterface|\Closure|array|string|null $append Expression or builder function to append. * to append. * @param string $conjunction type of conjunction to be used to operate part - * @param array $types associative array of type names used to bind values to query + * @param array $types Associative array of type names used to bind values to query * @return void */ protected function _conjugate(string $part, $append, $conjunction, array $types): void @@ -2327,7 +2364,14 @@ public function __clone() } if (is_array($part)) { foreach ($part as $i => $piece) { - if ($piece instanceof ExpressionInterface) { + if (is_array($piece)) { + foreach ($piece as $j => $value) { + if ($value instanceof ExpressionInterface) { + /** @psalm-suppress PossiblyUndefinedMethod */ + $this->_parts[$name][$i][$j] = clone $value; + } + } + } elseif ($piece instanceof ExpressionInterface) { /** @psalm-suppress PossiblyUndefinedMethod */ $this->_parts[$name][$i] = clone $piece; } @@ -2353,7 +2397,7 @@ public function __toString(): string * Returns an array that can be used to describe the internal state of this * object. * - * @return array + * @return array */ public function __debugInfo(): array { diff --git a/app/vendor/cakephp/cakephp/src/Database/QueryCompiler.php b/app/vendor/cakephp/cakephp/src/Database/QueryCompiler.php index 3f8bf33a..236d5eb7 100644 --- a/app/vendor/cakephp/cakephp/src/Database/QueryCompiler.php +++ b/app/vendor/cakephp/cakephp/src/Database/QueryCompiler.php @@ -32,7 +32,7 @@ class QueryCompiler * this query. There are some clauses that can be built as just as the * direct concatenation of the internal parts, those are listed here. * - * @var array + * @var array */ protected $_templates = [ 'delete' => 'DELETE', @@ -48,7 +48,7 @@ class QueryCompiler /** * The list of query clauses to traverse for generating a SELECT statement * - * @var array + * @var array */ protected $_selectParts = [ 'with', 'select', 'from', 'join', 'where', 'group', 'having', 'window', 'order', @@ -58,26 +58,26 @@ class QueryCompiler /** * The list of query clauses to traverse for generating an UPDATE statement * - * @var array + * @var array */ protected $_updateParts = ['with', 'update', 'set', 'where', 'epilog']; /** * The list of query clauses to traverse for generating a DELETE statement * - * @var array + * @var array */ protected $_deleteParts = ['with', 'delete', 'modifier', 'from', 'where', 'epilog']; /** * The list of query clauses to traverse for generating an INSERT statement * - * @var array + * @var array */ protected $_insertParts = ['with', 'insert', 'values', 'epilog']; /** - * Indicate whether or not this query dialect supports ordered unions. + * Indicate whether this query dialect supports ordered unions. * * Overridden in subclasses. * @@ -269,6 +269,13 @@ protected function _buildJoinPart(array $parts, Query $query, ValueBinder $binde { $joins = ''; foreach ($parts as $join) { + if (!isset($join['table'])) { + throw new DatabaseException(sprintf( + 'Could not compile join clause for alias `%s`. No table was specified. ' . + 'Use the `table` key to define a table.', + $join['alias'] + )); + } if ($join['table'] instanceof ExpressionInterface) { $join['table'] = '(' . $join['table']->sql($binder) . ')'; } @@ -279,10 +286,10 @@ protected function _buildJoinPart(array $parts, Query $query, ValueBinder $binde if (isset($join['conditions']) && $join['conditions'] instanceof ExpressionInterface) { $condition = $join['conditions']->sql($binder); } - if (strlen($condition)) { - $joins .= " ON {$condition}"; - } else { + if ($condition === '') { $joins .= ' ON 1 = 1'; + } else { + $joins .= " ON {$condition}"; } } diff --git a/app/vendor/cakephp/cakephp/src/Database/Retry/ErrorCodeWaitStrategy.php b/app/vendor/cakephp/cakephp/src/Database/Retry/ErrorCodeWaitStrategy.php index 564dcc41..010a531e 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Retry/ErrorCodeWaitStrategy.php +++ b/app/vendor/cakephp/cakephp/src/Database/Retry/ErrorCodeWaitStrategy.php @@ -28,7 +28,7 @@ class ErrorCodeWaitStrategy implements RetryStrategyInterface { /** - * @var int[] + * @var array */ protected $errorCodes; @@ -38,7 +38,7 @@ class ErrorCodeWaitStrategy implements RetryStrategyInterface protected $retryInterval; /** - * @param int[] $errorCodes DB-specific error codes that allow retrying + * @param array $errorCodes DB-specific error codes that allow retrying * @param int $retryInterval Seconds to wait before allowing next retry, 0 for no wait. */ public function __construct(array $errorCodes, int $retryInterval) diff --git a/app/vendor/cakephp/cakephp/src/Database/Retry/ReconnectStrategy.php b/app/vendor/cakephp/cakephp/src/Database/Retry/ReconnectStrategy.php index fc85a1ef..2cdd0980 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Retry/ReconnectStrategy.php +++ b/app/vendor/cakephp/cakephp/src/Database/Retry/ReconnectStrategy.php @@ -33,7 +33,7 @@ class ReconnectStrategy implements RetryStrategyInterface * * This is a static variable to enable opcache to inline the values. * - * @var array + * @var array */ protected static $causes = [ 'gone away', @@ -74,7 +74,7 @@ public function __construct(Connection $connection) /** * {@inheritDoc} * - * Checks whether or not the exception was caused by a lost connection, + * Checks whether the exception was caused by a lost connection, * and returns true if it was able to successfully reconnect. */ public function shouldRetry(Exception $exception, int $retryCount): bool @@ -93,7 +93,7 @@ public function shouldRetry(Exception $exception, int $retryCount): bool /** * Tries to re-establish the connection to the server, if it is safe to do so * - * @return bool Whether or not the connection was re-established + * @return bool Whether the connection was re-established */ protected function reconnect(): bool { diff --git a/app/vendor/cakephp/cakephp/src/Database/Schema/CachedCollection.php b/app/vendor/cakephp/cakephp/src/Database/Schema/CachedCollection.php index 7e7aac55..bf293799 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Schema/CachedCollection.php +++ b/app/vendor/cakephp/cakephp/src/Database/Schema/CachedCollection.php @@ -58,6 +58,14 @@ public function __construct(CollectionInterface $collection, string $prefix, Cac $this->cacher = $cacher; } + /** + * @inheritDoc + */ + public function listTablesWithoutViews(): array + { + return $this->collection->listTablesWithoutViews(); + } + /** * @inheritDoc */ diff --git a/app/vendor/cakephp/cakephp/src/Database/Schema/Collection.php b/app/vendor/cakephp/cakephp/src/Database/Schema/Collection.php index 0cf43cf6..3393e1bb 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Schema/Collection.php +++ b/app/vendor/cakephp/cakephp/src/Database/Schema/Collection.php @@ -54,9 +54,27 @@ public function __construct(Connection $connection) } /** - * Get the list of tables available in the current connection. + * Get the list of tables, excluding any views, available in the current connection. * - * @return string[] The list of tables in the connected database/schema. + * @return array The list of tables in the connected database/schema. + */ + public function listTablesWithoutViews(): array + { + [$sql, $params] = $this->_dialect->listTablesWithoutViewsSql($this->_connection->config()); + $result = []; + $statement = $this->_connection->execute($sql, $params); + while ($row = $statement->fetch()) { + $result[] = $row[0]; + } + $statement->closeCursor(); + + return $result; + } + + /** + * Get the list of tables and views available in the current connection. + * + * @return array The list of tables and views in the connected database/schema. */ public function listTables(): array { @@ -85,7 +103,7 @@ public function listTables(): array * Defaults to false. * * @param string $name The name of the table to describe. - * @param array $options The options to use, see above. + * @param array $options The options to use, see above. * @return \Cake\Database\Schema\TableSchema Object with column metadata. * @throws \Cake\Database\Exception\DatabaseException when table cannot be described. */ @@ -114,7 +132,7 @@ public function describe(string $name, array $options = []): TableSchemaInterfac * * @param string $stage The stage name. * @param string $name The table name. - * @param array $config The config data. + * @param array $config The config data. * @param \Cake\Database\Schema\TableSchema $schema The table schema instance. * @return void * @throws \Cake\Database\Exception\DatabaseException on query failure. diff --git a/app/vendor/cakephp/cakephp/src/Database/Schema/CollectionInterface.php b/app/vendor/cakephp/cakephp/src/Database/Schema/CollectionInterface.php index 2e318976..1861e368 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Schema/CollectionInterface.php +++ b/app/vendor/cakephp/cakephp/src/Database/Schema/CollectionInterface.php @@ -21,13 +21,16 @@ * * Used to access information about the tables, * and other data in a database. + * + * @method array listTablesWithoutViews() Get the list of tables available in the current connection. + * This will exclude any views in the schema. */ interface CollectionInterface { /** * Get the list of tables available in the current connection. * - * @return string[] The list of tables in the connected database/schema. + * @return array The list of tables in the connected database/schema. */ public function listTables(): array; @@ -43,7 +46,7 @@ public function listTables(): array; * Defaults to false. * * @param string $name The name of the table to describe. - * @param array $options The options to use, see above. + * @param array $options The options to use, see above. * @return \Cake\Database\Schema\TableSchemaInterface Object with column metadata. * @throws \Cake\Database\Exception\DatabaseException when table cannot be described. */ diff --git a/app/vendor/cakephp/cakephp/src/Database/Schema/MysqlSchemaDialect.php b/app/vendor/cakephp/cakephp/src/Database/Schema/MysqlSchemaDialect.php index 27755564..d8dddef8 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Schema/MysqlSchemaDialect.php +++ b/app/vendor/cakephp/cakephp/src/Database/Schema/MysqlSchemaDialect.php @@ -16,6 +16,7 @@ */ namespace Cake\Database\Schema; +use Cake\Database\DriverInterface; use Cake\Database\Exception\DatabaseException; /** @@ -33,11 +34,30 @@ class MysqlSchemaDialect extends SchemaDialect protected $_driver; /** - * @inheritDoc + * Generate the SQL to list the tables and views. + * + * @param array $config The connection configuration to use for + * getting tables from. + * @return array An array of (sql, params) to execute. */ public function listTablesSql(array $config): array { - return ['SHOW TABLES FROM ' . $this->_driver->quoteIdentifier($config['database']), []]; + return ['SHOW FULL TABLES FROM ' . $this->_driver->quoteIdentifier($config['database']), []]; + } + + /** + * Generate the SQL to list the tables, excluding all views. + * + * @param array $config The connection configuration to use for + * getting tables from. + * @return array An array of (sql, params) to execute. + */ + public function listTablesWithoutViewsSql(array $config): array + { + return [ + 'SHOW FULL TABLES FROM ' . $this->_driver->quoteIdentifier($config['database']) + . ' WHERE TABLE_TYPE = "BASE TABLE"' + , []]; } /** @@ -81,7 +101,7 @@ public function convertOptionsDescription(TableSchema $schema, array $row): void * The returned type will be a type that Cake\Database\TypeFactory can handle. * * @param string $column The column type + length - * @return array Array of column information. + * @return array Array of column information. * @throws \Cake\Database\Exception\DatabaseException When column type cannot be parsed. */ protected function _convertColumn(string $column): array @@ -92,7 +112,7 @@ protected function _convertColumn(string $column): array } $col = strtolower($matches[1]); - $length = $precision = null; + $length = $precision = $scale = null; if (isset($matches[2]) && strlen($matches[2])) { $length = $matches[2]; if (strpos($matches[2], ',') !== false) { @@ -102,6 +122,14 @@ protected function _convertColumn(string $column): array $precision = (int)$precision; } + $type = $this->_applyTypeSpecificColumnConversion( + $col, + compact('length', 'precision', 'scale') + ); + if ($type !== null) { + return $type; + } + if (in_array($col, ['date', 'time'])) { return ['type' => $col, 'length' => null]; } @@ -323,8 +351,14 @@ public function columnSql(TableSchema $schema, string $name): string { /** @var array $data */ $data = $schema->getColumn($name); + + $sql = $this->_getTypeSpecificColumnSql($data['type'], $schema, $name); + if ($sql !== null) { + return $sql; + } + $out = $this->_driver->quoteIdentifier($name); - $nativeJson = $this->_driver->supportsNativeJson(); + $nativeJson = $this->_driver->supports(DriverInterface::FEATURE_JSON); $typeMap = [ TableSchema::TYPE_TINYINTEGER => ' TINYINT', diff --git a/app/vendor/cakephp/cakephp/src/Database/Schema/PostgresSchemaDialect.php b/app/vendor/cakephp/cakephp/src/Database/Schema/PostgresSchemaDialect.php index 4b7806ee..4b2b6e7d 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Schema/PostgresSchemaDialect.php +++ b/app/vendor/cakephp/cakephp/src/Database/Schema/PostgresSchemaDialect.php @@ -26,11 +26,32 @@ class PostgresSchemaDialect extends SchemaDialect { /** - * @inheritDoc + * Generate the SQL to list the tables and views. + * + * @param array $config The connection configuration to use for + * getting tables from. + * @return array An array of (sql, params) to execute. */ public function listTablesSql(array $config): array { - $sql = 'SELECT table_name as name FROM information_schema.tables WHERE table_schema = ? ORDER BY name'; + $sql = 'SELECT table_name as name FROM information_schema.tables + WHERE table_schema = ? ORDER BY name'; + $schema = empty($config['schema']) ? 'public' : $config['schema']; + + return [$sql, [$schema]]; + } + + /** + * Generate the SQL to list the tables, excluding all views. + * + * @param array $config The connection configuration to use for + * getting tables from. + * @return array An array of (sql, params) to execute. + */ + public function listTablesWithoutViewsSql(array $config): array + { + $sql = 'SELECT table_name as name FROM information_schema.tables + WHERE table_schema = ? AND table_type = \'BASE TABLE\' ORDER BY name'; $schema = empty($config['schema']) ? 'public' : $config['schema']; return [$sql, [$schema]]; @@ -75,7 +96,7 @@ public function describeColumnSql(string $tableName, array $config): array * * @param string $column The column type + length * @throws \Cake\Database\Exception\DatabaseException when column cannot be parsed. - * @return array Array of column information. + * @return array Array of column information. */ protected function _convertColumn(string $column): array { @@ -85,11 +106,19 @@ protected function _convertColumn(string $column): array } $col = strtolower($matches[1]); - $length = null; + $length = $precision = $scale = null; if (isset($matches[2])) { $length = (int)$matches[2]; } + $type = $this->_applyTypeSpecificColumnConversion( + $col, + compact('length', 'precision', 'scale') + ); + if ($type !== null) { + return $type; + } + if (in_array($col, ['date', 'time', 'boolean'], true)) { return ['type' => $col, 'length' => null]; } @@ -379,6 +408,12 @@ public function columnSql(TableSchema $schema, string $name): string { /** @var array $data */ $data = $schema->getColumn($name); + + $sql = $this->_getTypeSpecificColumnSql($data['type'], $schema, $name); + if ($sql !== null) { + return $sql; + } + $out = $this->_driver->quoteIdentifier($name); $typeMap = [ TableSchema::TYPE_TINYINTEGER => ' SMALLINT', @@ -559,7 +594,7 @@ public function indexSql(TableSchema $schema, string $name): string */ public function constraintSql(TableSchema $schema, string $name): string { - /** @var array $data */ + /** @var array $data */ $data = $schema->getConstraint($name); $out = 'CONSTRAINT ' . $this->_driver->quoteIdentifier($name); if ($data['type'] === TableSchema::CONSTRAINT_PRIMARY) { @@ -576,7 +611,7 @@ public function constraintSql(TableSchema $schema, string $name): string * Helper method for generating key SQL snippets. * * @param string $prefix The key prefix - * @param array $data Key data. + * @param array $data Key data. * @return string */ protected function _keySql(string $prefix, array $data): string diff --git a/app/vendor/cakephp/cakephp/src/Database/Schema/SchemaDialect.php b/app/vendor/cakephp/cakephp/src/Database/Schema/SchemaDialect.php index 94813470..58b2e682 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Schema/SchemaDialect.php +++ b/app/vendor/cakephp/cakephp/src/Database/Schema/SchemaDialect.php @@ -17,6 +17,8 @@ namespace Cake\Database\Schema; use Cake\Database\DriverInterface; +use Cake\Database\Type\ColumnSchemaAwareInterface; +use Cake\Database\TypeFactory; use InvalidArgumentException; /** @@ -24,6 +26,8 @@ * * This class contains methods that are common across * the various SQL dialects. + * + * @method array listTablesWithoutViewsSql(array $config) Generate the SQL to list the tables, excluding all views. */ abstract class SchemaDialect { @@ -97,7 +101,7 @@ protected function _convertOnClause(string $clause): string * Convert foreign key constraints references to a valid * stringified list * - * @param string|array $references The referenced columns of a foreign key constraint statement + * @param array|string $references The referenced columns of a foreign key constraint statement * @return string */ protected function _convertConstraintColumns($references): string @@ -112,6 +116,56 @@ protected function _convertConstraintColumns($references): string )); } + /** + * Tries to use a matching database type to generate the SQL + * fragment for a single column in a table. + * + * @param string $columnType The column type. + * @param \Cake\Database\Schema\TableSchemaInterface $schema The table schema instance the column is in. + * @param string $column The name of the column. + * @return string|null An SQL fragment, or `null` in case no corresponding type was found or the type didn't provide + * custom column SQL. + */ + protected function _getTypeSpecificColumnSql( + string $columnType, + TableSchemaInterface $schema, + string $column + ): ?string { + if (!TypeFactory::getMap($columnType)) { + return null; + } + + $type = TypeFactory::build($columnType); + if (!($type instanceof ColumnSchemaAwareInterface)) { + return null; + } + + return $type->getColumnSql($schema, $column, $this->_driver); + } + + /** + * Tries to use a matching database type to convert a SQL column + * definition to an abstract type definition. + * + * @param string $columnType The column type. + * @param array $definition The column definition. + * @return array|null Array of column information, or `null` in case no corresponding type was found or the type + * didn't provide custom column information. + */ + protected function _applyTypeSpecificColumnConversion(string $columnType, array $definition): ?array + { + if (!TypeFactory::getMap($columnType)) { + return null; + } + + $type = TypeFactory::build($columnType); + if (!($type instanceof ColumnSchemaAwareInterface)) { + return null; + } + + return $type->convertColumnDefinition($definition, $this->_driver); + } + /** * Generate the SQL to drop a table. * @@ -131,7 +185,7 @@ public function dropTableSql(TableSchema $schema): array /** * Generate the SQL to list the tables. * - * @param array $config The connection configuration to use for + * @param array $config The connection configuration to use for * getting tables from. * @return array An array of (sql, params) to execute. */ @@ -141,7 +195,7 @@ abstract public function listTablesSql(array $config): array; * Generate the SQL to describe a table. * * @param string $tableName The table name to get information on. - * @param array $config The connection configuration. + * @param array $config The connection configuration. * @return array An array of (sql, params) to execute. */ abstract public function describeColumnSql(string $tableName, array $config): array; @@ -150,7 +204,7 @@ abstract public function describeColumnSql(string $tableName, array $config): ar * Generate the SQL to describe the indexes in a table. * * @param string $tableName The table name to get information on. - * @param array $config The connection configuration. + * @param array $config The connection configuration. * @return array An array of (sql, params) to execute. */ abstract public function describeIndexSql(string $tableName, array $config): array; @@ -159,7 +213,7 @@ abstract public function describeIndexSql(string $tableName, array $config): arr * Generate the SQL to describe the foreign keys in a table. * * @param string $tableName The table name to get information on. - * @param array $config The connection configuration. + * @param array $config The connection configuration. * @return array An array of (sql, params) to execute. */ abstract public function describeForeignKeySql(string $tableName, array $config): array; @@ -168,7 +222,7 @@ abstract public function describeForeignKeySql(string $tableName, array $config) * Generate the SQL to describe table options * * @param string $tableName Table name. - * @param array $config The connection configuration. + * @param array $config The connection configuration. * @return array SQL statements to get options for a table. */ public function describeOptionsSql(string $tableName, array $config): array @@ -220,10 +274,10 @@ public function convertOptionsDescription(TableSchema $schema, array $row): void * Generate the SQL to create a table. * * @param \Cake\Database\Schema\TableSchema $schema Table instance. - * @param string[] $columns The columns to go inside the table. - * @param string[] $constraints The constraints for the table. - * @param string[] $indexes The indexes for the table. - * @return string[] SQL statements to create a table. + * @param array $columns The columns to go inside the table. + * @param array $constraints The constraints for the table. + * @param array $indexes The indexes for the table. + * @return array SQL statements to create a table. */ abstract public function createTableSql( TableSchema $schema, diff --git a/app/vendor/cakephp/cakephp/src/Database/Schema/SqliteSchemaDialect.php b/app/vendor/cakephp/cakephp/src/Database/Schema/SqliteSchemaDialect.php index 77cf0e49..10b6fe16 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Schema/SqliteSchemaDialect.php +++ b/app/vendor/cakephp/cakephp/src/Database/Schema/SqliteSchemaDialect.php @@ -29,7 +29,7 @@ class SqliteSchemaDialect extends SchemaDialect * Array containing the foreign keys constraints names * Necessary for composite foreign keys to be handled * - * @var array + * @var array */ protected $_constraintsIdMap = []; @@ -48,7 +48,7 @@ class SqliteSchemaDialect extends SchemaDialect * * @param string $column The column type + length * @throws \Cake\Database\Exception\DatabaseException when unable to parse column type - * @return array Array of column information. + * @return array Array of column information. */ protected function _convertColumn(string $column): array { @@ -67,7 +67,7 @@ protected function _convertColumn(string $column): array } $col = strtolower($matches[2]); - $length = $precision = null; + $length = $precision = $scale = null; if (isset($matches[3])) { $length = $matches[3]; if (strpos($length, ',') !== false) { @@ -77,6 +77,14 @@ protected function _convertColumn(string $column): array $precision = (int)$precision; } + $type = $this->_applyTypeSpecificColumnConversion( + $col, + compact('length', 'precision', 'scale') + ); + if ($type !== null) { + return $type; + } + if ($col === 'bigint') { return ['type' => TableSchema::TYPE_BIGINTEGER, 'length' => $length, 'unsigned' => $unsigned]; } @@ -144,9 +152,30 @@ protected function _convertColumn(string $column): array } /** - * @inheritDoc + * Generate the SQL to list the tables and views. + * + * @param array $config The connection configuration to use for + * getting tables from. + * @return array An array of (sql, params) to execute. */ public function listTablesSql(array $config): array + { + return [ + 'SELECT name FROM sqlite_master ' . + 'WHERE (type="table" OR type="view") ' . + 'AND name != "sqlite_sequence" ORDER BY name', + [], + ]; + } + + /** + * Generate the SQL to list the tables, excluding all views. + * + * @param array $config The connection configuration to use for + * getting tables from. + * @return array An array of (sql, params) to execute. + */ + public function listTablesWithoutViewsSql(array $config): array { return [ 'SELECT name FROM sqlite_master WHERE type="table" ' . @@ -327,6 +356,12 @@ public function columnSql(TableSchema $schema, string $name): string { /** @var array $data */ $data = $schema->getColumn($name); + + $sql = $this->_getTypeSpecificColumnSql($data['type'], $schema, $name); + if ($sql !== null) { + return $sql; + } + $typeMap = [ TableSchema::TYPE_BINARY_UUID => ' BINARY(16)', TableSchema::TYPE_UUID => ' CHAR(36)', diff --git a/app/vendor/cakephp/cakephp/src/Database/Schema/SqlserverSchemaDialect.php b/app/vendor/cakephp/cakephp/src/Database/Schema/SqlserverSchemaDialect.php index 2178e3ab..1323869a 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Schema/SqlserverSchemaDialect.php +++ b/app/vendor/cakephp/cakephp/src/Database/Schema/SqlserverSchemaDialect.php @@ -29,7 +29,11 @@ class SqlserverSchemaDialect extends SchemaDialect public const DEFAULT_SCHEMA_NAME = 'dbo'; /** - * @inheritDoc + * Generate the SQL to list the tables and views. + * + * @param array $config The connection configuration to use for + * getting tables from. + * @return array An array of (sql, params) to execute. */ public function listTablesSql(array $config): array { @@ -43,6 +47,25 @@ public function listTablesSql(array $config): array return [$sql, [$schema]]; } + /** + * Generate the SQL to list the tables, excluding all views. + * + * @param array $config The connection configuration to use for + * getting tables from. + * @return array An array of (sql, params) to execute. + */ + public function listTablesWithoutViewsSql(array $config): array + { + $sql = "SELECT TABLE_NAME + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_SCHEMA = ? + AND (TABLE_TYPE = 'BASE TABLE') + ORDER BY TABLE_NAME"; + $schema = empty($config['schema']) ? static::DEFAULT_SCHEMA_NAME : $config['schema']; + + return [$sql, [$schema]]; + } + /** * @inheritDoc */ @@ -81,7 +104,7 @@ public function describeColumnSql(string $tableName, array $config): array * @param int|null $length the column length * @param int|null $precision The column precision * @param int|null $scale The column scale - * @return array Array of column information. + * @return array Array of column information. * @link https://technet.microsoft.com/en-us/library/ms187752.aspx */ protected function _convertColumn( @@ -92,6 +115,14 @@ protected function _convertColumn( ): array { $col = strtolower($col); + $type = $this->_applyTypeSpecificColumnConversion( + $col, + compact('length', 'precision', 'scale') + ); + if ($type !== null) { + return $type; + } + if (in_array($col, ['date', 'time'])) { return ['type' => $col, 'length' => null]; } @@ -213,7 +244,7 @@ public function convertColumnDescription(TableSchema $schema, array $row): void protected function _defaultValue($type, $default) { if ($default === null) { - return $default; + return null; } // remove () surrounding value (NULL) but leave () at the end of functions @@ -317,7 +348,8 @@ public function describeForeignKeySql(string $tableName, array $config): array INNER JOIN sys.schemas S ON S.schema_id = T.schema_id AND S.schema_id = RT.schema_id INNER JOIN sys.columns C ON C.column_id = FKC.parent_column_id AND C.object_id = FKC.parent_object_id INNER JOIN sys.columns RC ON RC.column_id = FKC.referenced_column_id AND RC.object_id = FKC.referenced_object_id - WHERE FK.is_ms_shipped = 0 AND T.name = ? AND S.name = ?'; + WHERE FK.is_ms_shipped = 0 AND T.name = ? AND S.name = ? + ORDER BY FKC.constraint_column_id'; // phpcs:enable Generic.Files.LineLength $schema = empty($config['schema']) ? static::DEFAULT_SCHEMA_NAME : $config['schema']; @@ -377,6 +409,12 @@ public function columnSql(TableSchema $schema, string $name): string { /** @var array $data */ $data = $schema->getColumn($name); + + $sql = $this->_getTypeSpecificColumnSql($data['type'], $schema, $name); + if ($sql !== null) { + return $sql; + } + $out = $this->_driver->quoteIdentifier($name); $typeMap = [ TableSchema::TYPE_TINYINTEGER => ' TINYINT', diff --git a/app/vendor/cakephp/cakephp/src/Database/Schema/TableSchema.php b/app/vendor/cakephp/cakephp/src/Database/Schema/TableSchema.php index 4c43492a..f9ad3dcb 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Schema/TableSchema.php +++ b/app/vendor/cakephp/cakephp/src/Database/Schema/TableSchema.php @@ -43,28 +43,28 @@ class TableSchema implements TableSchemaInterface, SqlGeneratorInterface /** * Columns in the table. * - * @var array + * @var array */ protected $_columns = []; /** * A map with columns to types * - * @var array + * @var array */ protected $_typeMap = []; /** * Indexes in the table. * - * @var array + * @var array */ protected $_indexes = []; /** * Constraints in the table. * - * @var array + * @var array> */ protected $_constraints = []; @@ -76,7 +76,7 @@ class TableSchema implements TableSchemaInterface, SqlGeneratorInterface protected $_options = []; /** - * Whether or not the table is temporary + * Whether the table is temporary * * @var bool */ @@ -106,7 +106,7 @@ class TableSchema implements TableSchemaInterface, SqlGeneratorInterface /** * Valid column length that can be used with text type columns * - * @var array + * @var array */ public static $columnLengths = [ 'tiny' => self::LENGTH_TINY, @@ -118,7 +118,7 @@ class TableSchema implements TableSchemaInterface, SqlGeneratorInterface * The valid keys that can be used in a column * definition. * - * @var array + * @var array */ protected static $_columnKeys = [ 'type' => null, @@ -133,7 +133,7 @@ class TableSchema implements TableSchemaInterface, SqlGeneratorInterface /** * Additional type specific properties. * - * @var array + * @var array> */ protected static $_columnExtras = [ 'string' => [ @@ -171,7 +171,7 @@ class TableSchema implements TableSchemaInterface, SqlGeneratorInterface * The valid keys that can be used in an index * definition. * - * @var array + * @var array */ protected static $_indexKeys = [ 'type' => null, @@ -185,7 +185,7 @@ class TableSchema implements TableSchemaInterface, SqlGeneratorInterface /** * Names of the valid index types. * - * @var array + * @var array */ protected static $_validIndexTypes = [ self::INDEX_INDEX, @@ -195,7 +195,7 @@ class TableSchema implements TableSchemaInterface, SqlGeneratorInterface /** * Names of the valid constraint types. * - * @var array + * @var array */ protected static $_validConstraintTypes = [ self::CONSTRAINT_PRIMARY, @@ -206,7 +206,7 @@ class TableSchema implements TableSchemaInterface, SqlGeneratorInterface /** * Names of the valid foreign key actions. * - * @var array + * @var array */ protected static $_validForeignKeyActions = [ self::ACTION_CASCADE, @@ -290,7 +290,7 @@ class TableSchema implements TableSchemaInterface, SqlGeneratorInterface * Constructor. * * @param string $table The table name. - * @param array $columns The list of columns for the schema. + * @param array $columns The list of columns for the schema. */ public function __construct(string $table, array $columns = []) { @@ -624,7 +624,7 @@ public function dropConstraint(string $name) } /** - * Check whether or not a table has an autoIncrement column defined. + * Check whether a table has an autoIncrement column defined. * * @return bool */ @@ -642,8 +642,8 @@ public function hasAutoincrement(): bool /** * Helper method to check/validate foreign keys. * - * @param array $attrs Attributes to set. - * @return array + * @param array $attrs Attributes to set. + * @return array * @throws \Cake\Database\Exception\DatabaseException When foreign key definition is not valid. */ protected function _checkForeignKey(array $attrs): array @@ -680,11 +680,7 @@ public function constraints(): array */ public function getConstraint(string $name): ?array { - if (!isset($this->_constraints[$name])) { - return null; - } - - return $this->_constraints[$name]; + return $this->_constraints[$name] ?? null; } /** @@ -692,7 +688,7 @@ public function getConstraint(string $name): ?array */ public function setOptions(array $options) { - $this->_options = array_merge($this->_options, $options); + $this->_options = $options + $this->_options; return $this; } @@ -786,7 +782,7 @@ public function dropConstraintSql(Connection $connection): array /** * Returns an array of the table schema. * - * @return array + * @return array */ public function __debugInfo(): array { diff --git a/app/vendor/cakephp/cakephp/src/Database/Schema/TableSchemaInterface.php b/app/vendor/cakephp/cakephp/src/Database/Schema/TableSchemaInterface.php index 7aa2f8d1..19e942de 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Schema/TableSchemaInterface.php +++ b/app/vendor/cakephp/cakephp/src/Database/Schema/TableSchemaInterface.php @@ -171,7 +171,7 @@ interface TableSchemaInterface extends SchemaInterface public const TYPE_UUID = 'uuid'; /** - * Check whether or not a table has an autoIncrement column defined. + * Check whether a table has an autoIncrement column defined. * * @return bool */ @@ -180,7 +180,7 @@ public function hasAutoincrement(): bool; /** * Sets whether the table is temporary in the database. * - * @param bool $temporary Whether or not the table is to be temporary. + * @param bool $temporary Whether the table is to be temporary. * @return $this */ public function setTemporary(bool $temporary); @@ -195,7 +195,7 @@ public function isTemporary(): bool; /** * Get the column(s) used for the primary key. * - * @return array Column name(s) for the primary key. An + * @return array Column name(s) for the primary key. An * empty list will be returned when the table has no primary key. */ public function getPrimaryKey(): array; @@ -212,7 +212,7 @@ public function getPrimaryKey(): array; * - `columns` The columns in the index. * * @param string $name The name of the index. - * @param array|string $attrs The attributes for the index. + * @param array|string $attrs The attributes for the index. * If string it will be used as `type`. * @return $this * @throws \Cake\Database\Exception\DatabaseException @@ -223,14 +223,14 @@ public function addIndex(string $name, $attrs); * Read information about an index based on name. * * @param string $name The name of the index. - * @return array|null Array of index data, or null + * @return array|null Array of index data, or null */ public function getIndex(string $name): ?array; /** * Get the names of all the indexes in the table. * - * @return string[] + * @return array */ public function indexes(): array; @@ -251,7 +251,7 @@ public function indexes(): array; * The default for 'update' & 'delete' is 'cascade'. * * @param string $name The name of the constraint. - * @param array|string $attrs The attributes for the constraint. + * @param array|string $attrs The attributes for the constraint. * If string it will be used as `type`. * @return $this * @throws \Cake\Database\Exception\DatabaseException @@ -262,7 +262,7 @@ public function addConstraint(string $name, $attrs); * Read information about a constraint based on name. * * @param string $name The name of the constraint. - * @return array|null Array of constraint data, or null + * @return array|null Array of constraint data, or null */ public function getConstraint(string $name): ?array; @@ -277,7 +277,7 @@ public function dropConstraint(string $name); /** * Get the names of all the constraints in the table. * - * @return string[] + * @return array */ public function constraints(): array; } diff --git a/app/vendor/cakephp/cakephp/src/Database/SchemaCache.php b/app/vendor/cakephp/cakephp/src/Database/SchemaCache.php index 0dfda3bd..43053044 100644 --- a/app/vendor/cakephp/cakephp/src/Database/SchemaCache.php +++ b/app/vendor/cakephp/cakephp/src/Database/SchemaCache.php @@ -51,12 +51,13 @@ public function __construct(Connection $connection) * Build metadata. * * @param string|null $name The name of the table to build cache data for. - * @return array Returns a list build table caches + * @return array Returns a list build table caches */ public function build(?string $name = null): array { - $tables = [$name]; - if (empty($name)) { + if ($name) { + $tables = [$name]; + } else { $tables = $this->_schema->listTables(); } @@ -72,12 +73,13 @@ public function build(?string $name = null): array * Clear metadata. * * @param string|null $name The name of the table to clear cache data for. - * @return array Returns a list of cleared table caches + * @return array Returns a list of cleared table caches */ public function clear(?string $name = null): array { - $tables = [$name]; - if (empty($name)) { + if ($name) { + $tables = [$name]; + } else { $tables = $this->_schema->listTables(); } diff --git a/app/vendor/cakephp/cakephp/src/Database/Statement/BufferResultsTrait.php b/app/vendor/cakephp/cakephp/src/Database/Statement/BufferResultsTrait.php index e4e690f3..b6a5e579 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Statement/BufferResultsTrait.php +++ b/app/vendor/cakephp/cakephp/src/Database/Statement/BufferResultsTrait.php @@ -24,14 +24,14 @@ trait BufferResultsTrait { /** - * Whether or not to buffer results in php + * Whether to buffer results in php * * @var bool */ protected $_bufferResults = true; /** - * Whether or not to buffer results in php + * Whether to buffer results in php * * @param bool $buffer Toggle buffering * @return $this diff --git a/app/vendor/cakephp/cakephp/src/Database/Statement/BufferedStatement.php b/app/vendor/cakephp/cakephp/src/Database/Statement/BufferedStatement.php index d4a00909..7f7f462e 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Statement/BufferedStatement.php +++ b/app/vendor/cakephp/cakephp/src/Database/Statement/BufferedStatement.php @@ -55,12 +55,12 @@ class BufferedStatement implements Iterator, StatementInterface /** * The in-memory cache containing results from previous iterators * - * @var array + * @var array */ protected $buffer = []; /** - * Whether or not this statement has already been executed + * Whether this statement has already been executed * * @var bool */ @@ -89,7 +89,7 @@ public function __construct(StatementInterface $statement, DriverInterface $driv * Magic getter to return $queryString as read-only. * * @param string $property internal property to get - * @return mixed + * @return string|null */ public function __get(string $property) { @@ -97,6 +97,8 @@ public function __get(string $property) /** @psalm-suppress NoInterfaceProperties */ return $this->statement->queryString; } + + return null; } /** @@ -193,7 +195,7 @@ public function lastInsertId(?string $table = null, ?string $column = null) /** * {@inheritDoc} * - * @param int|string $type The type to fetch. + * @param string|int $type The type to fetch. * @return array|false */ public function fetch($type = self::FETCH_TYPE_NUM) @@ -225,7 +227,7 @@ public function fetch($type = self::FETCH_TYPE_NUM) } /** - * @inheritDoc + * @return array */ public function fetchAssoc(): array { @@ -281,6 +283,7 @@ protected function _reset(): void * * @return mixed */ + #[\ReturnTypeWillChange] public function key() { return $this->index; @@ -291,6 +294,7 @@ public function key() * * @return mixed */ + #[\ReturnTypeWillChange] public function current() { return $this->buffer[$this->index]; @@ -307,7 +311,7 @@ public function rewind(): void } /** - * Returns whether or not the iterator has more elements + * Returns whether the iterator has more elements * * @return bool */ diff --git a/app/vendor/cakephp/cakephp/src/Database/Statement/CallbackStatement.php b/app/vendor/cakephp/cakephp/src/Database/Statement/CallbackStatement.php index 692a2aa2..a0b59c36 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Statement/CallbackStatement.php +++ b/app/vendor/cakephp/cakephp/src/Database/Statement/CallbackStatement.php @@ -64,16 +64,14 @@ public function fetch($type = parent::FETCH_TYPE_NUM) } /** - * Fetch all rows from the statement. + * {@inheritDoc} * * Each row in the result will be processed by the callback when it is not `false. - * - * @param string|int $type Either 'num' or 'assoc' to indicate the result format you would like. - * @return array */ - public function fetchAll($type = parent::FETCH_TYPE_NUM): array + public function fetchAll($type = parent::FETCH_TYPE_NUM) { - /** @psalm-suppress PossiblyFalseArgument */ - return array_map($this->_callback, $this->_statement->fetchAll($type)); + $results = $this->_statement->fetchAll($type); + + return $results !== false ? array_map($this->_callback, $results) : false; } } diff --git a/app/vendor/cakephp/cakephp/src/Database/Statement/PDOStatement.php b/app/vendor/cakephp/cakephp/src/Database/Statement/PDOStatement.php index fbc8349d..5e7309ad 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Statement/PDOStatement.php +++ b/app/vendor/cakephp/cakephp/src/Database/Statement/PDOStatement.php @@ -46,6 +46,22 @@ public function __construct(Statement $statement, DriverInterface $driver) $this->_driver = $driver; } + /** + * Magic getter to return PDOStatement::$queryString as read-only. + * + * @param string $property internal property to get + * @return string|null + */ + public function __get(string $property) + { + if ($property === 'queryString' && isset($this->_statement->queryString)) { + /** @psalm-suppress NoInterfaceProperties */ + return $this->_statement->queryString; + } + + return null; + } + /** * Assign a value to a positional or named variable in prepared query. If using * positional variables you need to start with index one, if using named params then diff --git a/app/vendor/cakephp/cakephp/src/Database/Statement/StatementDecorator.php b/app/vendor/cakephp/cakephp/src/Database/Statement/StatementDecorator.php index b7eb3c36..4a1d33e9 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Statement/StatementDecorator.php +++ b/app/vendor/cakephp/cakephp/src/Database/Statement/StatementDecorator.php @@ -53,7 +53,7 @@ class StatementDecorator implements StatementInterface, Countable, IteratorAggre protected $_driver; /** - * Whether or not this statement has already been executed + * Whether this statement has already been executed * * @var bool */ @@ -76,7 +76,7 @@ public function __construct(StatementInterface $statement, DriverInterface $driv * Magic getter to return $queryString as read-only. * * @param string $property internal property to get - * @return mixed + * @return string|null */ public function __get(string $property) { @@ -84,6 +84,8 @@ public function __get(string $property) /** @psalm-suppress NoInterfaceProperties */ return $this->_statement->queryString; } + + return null; } /** @@ -144,7 +146,7 @@ public function columnCount(): int /** * Returns the error code for the last error that occurred when executing this statement. * - * @return int|string + * @return string|int */ public function errorCode() { @@ -202,9 +204,9 @@ public function fetch($type = self::FETCH_TYPE_NUM) /** * Returns the next row in a result set as an associative array. Calling this function is the same as calling - * $statement->fetch(StatementDecorator::FETCH_TYPE_ASSOC). If no results are found false is returned. + * $statement->fetch(StatementDecorator::FETCH_TYPE_ASSOC). If no results are found an empty array is returned. * - * @return array Result array containing columns and values an an associative array or an empty array if no results + * @return array */ public function fetchAssoc(): array { @@ -282,6 +284,7 @@ public function rowCount(): int * @return \Cake\Database\StatementInterface * @psalm-suppress ImplementedReturnTypeMismatch */ + #[\ReturnTypeWillChange] public function getIterator() { if (!$this->_hasExecuted) { @@ -315,13 +318,10 @@ public function bind(array $params, array $types): void return; } - $anonymousParams = is_int(key($params)) ? true : false; + $anonymousParams = is_int(key($params)); $offset = 1; foreach ($params as $index => $value) { - $type = null; - if (isset($types[$index])) { - $type = $types[$index]; - } + $type = $types[$index] ?? null; if ($anonymousParams) { /** @psalm-suppress InvalidOperand */ $index += $offset; diff --git a/app/vendor/cakephp/cakephp/src/Database/StatementInterface.php b/app/vendor/cakephp/cakephp/src/Database/StatementInterface.php index 0c0dc5f8..dc5bbc67 100644 --- a/app/vendor/cakephp/cakephp/src/Database/StatementInterface.php +++ b/app/vendor/cakephp/cakephp/src/Database/StatementInterface.php @@ -94,7 +94,7 @@ public function columnCount(): int; /** * Returns the error code for the last error that occurred when executing this statement * - * @return int|string + * @return string|int */ public function errorCode(); diff --git a/app/vendor/cakephp/cakephp/src/Database/Type/BatchCastingInterface.php b/app/vendor/cakephp/cakephp/src/Database/Type/BatchCastingInterface.php index 04b74c72..35f046bc 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Type/BatchCastingInterface.php +++ b/app/vendor/cakephp/cakephp/src/Database/Type/BatchCastingInterface.php @@ -29,7 +29,7 @@ interface BatchCastingInterface * this type. * * @param array $values The original array of values containing the fields to be casted - * @param string[] $fields The field keys to cast + * @param array $fields The field keys to cast * @param \Cake\Database\DriverInterface $driver Object from which database preferences and configuration will be extracted. * @return array */ diff --git a/app/vendor/cakephp/cakephp/src/Database/Type/BinaryType.php b/app/vendor/cakephp/cakephp/src/Database/Type/BinaryType.php index 059e2412..e570f53d 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Type/BinaryType.php +++ b/app/vendor/cakephp/cakephp/src/Database/Type/BinaryType.php @@ -35,7 +35,7 @@ class BinaryType extends BaseType * * @param mixed $value The value to convert. * @param \Cake\Database\DriverInterface $driver The driver instance to convert with. - * @return string|resource + * @return resource|string */ public function toDatabase($value, DriverInterface $driver) { diff --git a/app/vendor/cakephp/cakephp/src/Database/Type/BinaryUuidType.php b/app/vendor/cakephp/cakephp/src/Database/Type/BinaryUuidType.php index 66e2b192..559f2767 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Type/BinaryUuidType.php +++ b/app/vendor/cakephp/cakephp/src/Database/Type/BinaryUuidType.php @@ -36,7 +36,7 @@ class BinaryUuidType extends BaseType * * @param mixed $value The value to convert. * @param \Cake\Database\DriverInterface $driver The driver instance to convert with. - * @return string|resource|null + * @return resource|string|null */ public function toDatabase($value, DriverInterface $driver) { diff --git a/app/vendor/cakephp/cakephp/src/Database/Type/DateTimeType.php b/app/vendor/cakephp/cakephp/src/Database/Type/DateTimeType.php index cd380259..e87fdeaf 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Type/DateTimeType.php +++ b/app/vendor/cakephp/cakephp/src/Database/Type/DateTimeType.php @@ -37,7 +37,7 @@ class DateTimeType extends BaseType implements BatchCastingInterface { /** - * Whether or not we want to override the time of the converted Time objects + * Whether we want to override the time of the converted Time objects * so it points to the start of the day. * * This is primarily to avoid subclasses needing to re-implement the same functionality. @@ -56,7 +56,7 @@ class DateTimeType extends BaseType implements BatchCastingInterface /** * The DateTime formats allowed by `marshal()`. * - * @var array + * @var array */ protected $_marshalFormats = [ 'Y-m-d H:i', @@ -78,7 +78,7 @@ class DateTimeType extends BaseType implements BatchCastingInterface * * See `Cake\I18n\Time::parseDateTime()` for accepted formats. * - * @var string|array|int + * @var array|string|int */ protected $_localeMarshalFormat; @@ -97,6 +97,13 @@ class DateTimeType extends BaseType implements BatchCastingInterface */ protected $dbTimezone; + /** + * User time zone. + * + * @var \DateTimeZone|null + */ + protected $userTimezone; + /** * Default time zone. * @@ -121,7 +128,7 @@ public function __construct(?string $name = null) parent::__construct($name); $this->defaultTimezone = new DateTimeZone(date_default_timezone_get()); - $this->useImmutable(); + $this->_setClassName(FrozenTime::class, DateTimeImmutable::class); } /** @@ -157,7 +164,7 @@ public function toDatabase($value, DriverInterface $driver): ?string /** * Alias for `setDatabaseTimezone()`. * - * @param string|\DateTimeZone|null $timezone Database timezone. + * @param \DateTimeZone|string|null $timezone Database timezone. * @return $this * @deprecated 4.1.0 Use {@link setDatabaseTimezone()} instead. */ @@ -175,7 +182,7 @@ public function setTimezone($timezone) * instances and converting DateTime instances to database strings. * * @see DateTimeType::setKeepDatabaseTimezone - * @param string|\DateTimeZone|null $timezone Database timezone. + * @param \DateTimeZone|string|null $timezone Database timezone. * @return $this */ public function setDatabaseTimezone($timezone) @@ -188,6 +195,24 @@ public function setDatabaseTimezone($timezone) return $this; } + /** + * Set user timezone. + * + * This is the time zone used when marshalling strings to DateTime instances. + * + * @param \DateTimeZone|string|null $timezone User timezone. + * @return $this + */ + public function setUserTimezone($timezone) + { + if (is_string($timezone)) { + $timezone = new DateTimeZone($timezone); + } + $this->userTimezone = $timezone; + + return $this; + } + /** * {@inheritDoc} * @@ -295,7 +320,12 @@ public function manyToPHP(array $values, array $fields, DriverInterface $driver) public function marshal($value): ?DateTimeInterface { if ($value instanceof DateTimeInterface) { - return $value; + if ($value instanceof DateTime) { + $value = clone $value; + } + + /** @var \Datetime|\DateTimeImmutable $value */ + return $value->setTimezone($this->defaultTimezone); } /** @var class-string<\DatetimeInterface> $class */ @@ -304,13 +334,27 @@ public function marshal($value): ?DateTimeInterface if ($value === '' || $value === null || is_bool($value)) { return null; } - $isString = is_string($value); - if (ctype_digit($value)) { - return new $class('@' . $value); - } elseif ($isString && $this->_useLocaleMarshal) { - return $this->_parseLocaleValue($value); - } elseif ($isString) { - return $this->_parseValue($value); + + if (is_int($value) || (is_string($value) && ctype_digit($value))) { + /** @var \Datetime|\DateTimeImmutable $dateTime */ + $dateTime = new $class('@' . $value); + + return $dateTime->setTimezone($this->defaultTimezone); + } + + if (is_string($value)) { + if ($this->_useLocaleMarshal) { + $dateTime = $this->_parseLocaleValue($value); + } else { + $dateTime = $this->_parseValue($value); + } + + /** @var \Datetime|\DateTimeImmutable $dateTime */ + if ($dateTime !== null) { + $dateTime = $dateTime->setTimezone($this->defaultTimezone); + } + + return $dateTime; } } catch (Exception $e) { return null; @@ -347,16 +391,18 @@ public function marshal($value): ?DateTimeInterface $value['second'], $value['microsecond'] ); - $tz = $value['timezone'] ?? null; - return new $class($format, $tz); + /** @var \Datetime|\DateTimeImmutable $dateTime */ + $dateTime = new $class($format, $value['timezone'] ?? $this->userTimezone); + + return $dateTime->setTimezone($this->defaultTimezone); } /** - * Sets whether or not to parse strings passed to `marshal()` using + * Sets whether to parse strings passed to `marshal()` using * the locale-aware format set by `setLocaleFormat()`. * - * @param bool $enable Whether or not to enable + * @param bool $enable Whether to enable * @return $this */ public function useLocaleParser(bool $enable = true) @@ -381,7 +427,7 @@ public function useLocaleParser(bool $enable = true) * * See `Cake\I18n\Time::parseDateTime()` for accepted formats. * - * @param string|array $format The locale-aware format + * @param array|string $format The locale-aware format * @see \Cake\I18n\Time::parseDateTime() * @return $this */ @@ -396,9 +442,15 @@ public function setLocaleFormat($format) * Change the preferred class name to the FrozenTime implementation. * * @return $this + * @deprecated 4.3.0 This method is no longer needed as using immutable datetime class is the default behavior. */ public function useImmutable() { + deprecationWarning( + 'Configuring immutable or mutable classes is deprecated and immutable' + . ' classes will be the permanent configuration in 5.0. Calling `useImmutable()` is unnecessary.' + ); + $this->_setClassName(FrozenTime::class, DateTimeImmutable::class); return $this; @@ -436,9 +488,15 @@ public function getDateTimeClassName(): string * Change the preferred class name to the mutable Time implementation. * * @return $this + * @deprecated 4.3.0 Using mutable datetime objects is deprecated. */ public function useMutable() { + deprecationWarning( + 'Configuring immutable or mutable classes is deprecated and immutable' + . ' classes will be the permanent configuration in 5.0. Calling `useImmutable()` is unnecessary.' + ); + $this->_setClassName(Time::class, DateTime::class); return $this; @@ -456,7 +514,7 @@ protected function _parseLocaleValue(string $value): ?I18nDateTimeInterface /** @psalm-var class-string<\Cake\I18n\I18nDateTimeInterface> $class */ $class = $this->_className; - return $class::parseDateTime($value, $this->_localeMarshalFormat); + return $class::parseDateTime($value, $this->_localeMarshalFormat, $this->userTimezone); } /** @@ -472,7 +530,7 @@ protected function _parseValue(string $value): ?DateTimeInterface foreach ($this->_marshalFormats as $format) { try { - $dateTime = $class::createFromFormat($format, $value); + $dateTime = $class::createFromFormat($format, $value, $this->userTimezone); // Check for false in case DateTime is used directly if ($dateTime !== false) { return $dateTime; diff --git a/app/vendor/cakephp/cakephp/src/Database/Type/DateType.php b/app/vendor/cakephp/cakephp/src/Database/Type/DateType.php index 773b30bd..19d5453f 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Type/DateType.php +++ b/app/vendor/cakephp/cakephp/src/Database/Type/DateType.php @@ -48,13 +48,29 @@ class DateType extends DateTimeType */ protected $setToDateStart = true; + /** + * @inheritDoc + */ + public function __construct(?string $name = null) + { + parent::__construct($name); + + $this->_setClassName(FrozenDate::class, DateTimeImmutable::class); + } + /** * Change the preferred class name to the FrozenDate implementation. * * @return $this + * @deprecated 4.3.0 This method is no longer needed as using immutable datetime class is the default behavior. */ public function useImmutable() { + deprecationWarning( + 'Configuring immutable or mutable classes is deprecated and immutable' + . ' classes will be the permanent configuration in 5.0. Calling `useImmutable()` is unnecessary.' + ); + $this->_setClassName(FrozenDate::class, DateTimeImmutable::class); return $this; @@ -64,9 +80,15 @@ public function useImmutable() * Change the preferred class name to the mutable Date implementation. * * @return $this + * @deprecated 4.3.0 Using mutable datetime objects is deprecated. */ public function useMutable() { + deprecationWarning( + 'Configuring immutable or mutable classes is deprecated and immutable' + . ' classes will be the permanent configuration in 5.0. Calling `useImmutable()` is unnecessary.' + ); + $this->_setClassName(Date::class, DateTime::class); return $this; @@ -81,10 +103,10 @@ public function useMutable() public function marshal($value): ?DateTimeInterface { $date = parent::marshal($value); + /** @psalm-var \DateTime|\DateTimeImmutable|null $date */ if ($date && !$date instanceof I18nDateTimeInterface) { // Clear time manually when I18n types aren't available and raw DateTime used - /** @psalm-var \DateTime|\DateTimeImmutable $date */ - $date->setTime(0, 0, 0); + $date = $date->setTime(0, 0, 0); } return $date; diff --git a/app/vendor/cakephp/cakephp/src/Database/Type/DecimalType.php b/app/vendor/cakephp/cakephp/src/Database/Type/DecimalType.php index 9359ca1d..cb332fd3 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Type/DecimalType.php +++ b/app/vendor/cakephp/cakephp/src/Database/Type/DecimalType.php @@ -145,10 +145,10 @@ public function marshal($value): ?string } /** - * Sets whether or not to parse numbers passed to the marshal() function + * Sets whether to parse numbers passed to the marshal() function * by using a locale aware parser. * - * @param bool $enable Whether or not to enable + * @param bool $enable Whether to enable * @return $this * @throws \RuntimeException */ diff --git a/app/vendor/cakephp/cakephp/src/Database/Type/ExpressionTypeCasterTrait.php b/app/vendor/cakephp/cakephp/src/Database/Type/ExpressionTypeCasterTrait.php index 597c18ad..621bb9db 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Type/ExpressionTypeCasterTrait.php +++ b/app/vendor/cakephp/cakephp/src/Database/Type/ExpressionTypeCasterTrait.php @@ -49,7 +49,7 @@ protected function _castToExpression($value, ?string $type = null) $multi = $type !== $baseType; if ($multi) { - /** @psalm-var \Cake\Database\Type\ExpressionTypeInterface $converter */ + /** @var \Cake\Database\Type\ExpressionTypeInterface $converter */ return array_map([$converter, 'toExpression'], $value); } diff --git a/app/vendor/cakephp/cakephp/src/Database/Type/FloatType.php b/app/vendor/cakephp/cakephp/src/Database/Type/FloatType.php index 0e257b49..27da61a5 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Type/FloatType.php +++ b/app/vendor/cakephp/cakephp/src/Database/Type/FloatType.php @@ -129,10 +129,10 @@ public function marshal($value) } /** - * Sets whether or not to parse numbers passed to the marshal() function + * Sets whether to parse numbers passed to the marshal() function * by using a locale aware parser. * - * @param bool $enable Whether or not to enable + * @param bool $enable Whether to enable * @return $this */ public function useLocaleParser(bool $enable = true) diff --git a/app/vendor/cakephp/cakephp/src/Database/Type/IntegerType.php b/app/vendor/cakephp/cakephp/src/Database/Type/IntegerType.php index 8352e4f1..212b1aab 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Type/IntegerType.php +++ b/app/vendor/cakephp/cakephp/src/Database/Type/IntegerType.php @@ -72,7 +72,7 @@ public function toDatabase($value, DriverInterface $driver): ?int public function toPHP($value, DriverInterface $driver): ?int { if ($value === null) { - return $value; + return null; } return (int)$value; diff --git a/app/vendor/cakephp/cakephp/src/Database/Type/JsonType.php b/app/vendor/cakephp/cakephp/src/Database/Type/JsonType.php index bd954492..5648d94d 100644 --- a/app/vendor/cakephp/cakephp/src/Database/Type/JsonType.php +++ b/app/vendor/cakephp/cakephp/src/Database/Type/JsonType.php @@ -27,6 +27,11 @@ */ class JsonType extends BaseType implements BatchCastingInterface { + /** + * @var int + */ + protected $_encodingOptions = 0; + /** * Convert a value data into a JSON string * @@ -45,7 +50,7 @@ public function toDatabase($value, DriverInterface $driver): ?string return null; } - return json_encode($value); + return json_encode($value, $this->_encodingOptions); } /** @@ -53,7 +58,7 @@ public function toDatabase($value, DriverInterface $driver): ?string * * @param mixed $value The value to convert. * @param \Cake\Database\DriverInterface $driver The driver instance to convert with. - * @return string|array|null + * @return array|string|null */ public function toPHP($value, DriverInterface $driver) { @@ -102,4 +107,18 @@ public function marshal($value) { return $value; } + + /** + * Set json_encode options. + * + * @param int $options Encoding flags. Use JSON_* flags. Set `0` to reset. + * @return $this + * @see https://www.php.net/manual/en/function.json-encode.php + */ + public function setEncodingOptions(int $options) + { + $this->_encodingOptions = $options; + + return $this; + } } diff --git a/app/vendor/cakephp/cakephp/src/Database/TypeFactory.php b/app/vendor/cakephp/cakephp/src/Database/TypeFactory.php index 361dfc9a..2f500669 100644 --- a/app/vendor/cakephp/cakephp/src/Database/TypeFactory.php +++ b/app/vendor/cakephp/cakephp/src/Database/TypeFactory.php @@ -58,7 +58,7 @@ class TypeFactory /** * Contains a map of type object instances to be reused if needed. * - * @var \Cake\Database\TypeInterface[] + * @var array<\Cake\Database\TypeInterface> */ protected static $_builtTypes = []; @@ -84,7 +84,7 @@ public static function build(string $name): TypeInterface /** * Returns an arrays with all the mapped type objects, indexed by name. * - * @return \Cake\Database\TypeInterface[] + * @return array<\Cake\Database\TypeInterface> */ public static function buildAll(): array { @@ -126,7 +126,7 @@ public static function map(string $type, string $className): void /** * Set type to classname mapping. * - * @param string[] $map List of types to be mapped. + * @param array $map List of types to be mapped. * @return void * @psalm-param array> $map */ @@ -140,7 +140,7 @@ public static function setMap(array $map): void * Get mapped class name for given type or map array. * * @param string|null $type Type name to get mapped class for or null to get map array. - * @return string[]|string|null Configured class name for given $type or map array. + * @return array|string|null Configured class name for given $type or map array. */ public static function getMap(?string $type = null) { diff --git a/app/vendor/cakephp/cakephp/src/Database/TypeMap.php b/app/vendor/cakephp/cakephp/src/Database/TypeMap.php index 455e7666..ad3482cb 100644 --- a/app/vendor/cakephp/cakephp/src/Database/TypeMap.php +++ b/app/vendor/cakephp/cakephp/src/Database/TypeMap.php @@ -27,7 +27,7 @@ class TypeMap * Used to avoid repetition when calling multiple functions inside this class that * may require a custom type for a specific field. * - * @var string[] + * @var array */ protected $_defaults = []; @@ -37,14 +37,14 @@ class TypeMap * Used to avoid repetition when calling multiple functions inside this class that * may require a custom type for a specific field. * - * @var string[] + * @var array */ protected $_types = []; /** * Creates an instance with the given defaults * - * @param string[] $defaults The defaults to use. + * @param array $defaults The defaults to use. */ public function __construct(array $defaults = []) { @@ -69,7 +69,7 @@ public function __construct(array $defaults = []) * This method will replace all the existing default mappings with the ones provided. * To add into the mappings use `addDefaults()`. * - * @param string[] $defaults Associative array where keys are field names and values + * @param array $defaults Associative array where keys are field names and values * are the correspondent type. * @return $this */ @@ -83,7 +83,7 @@ public function setDefaults(array $defaults) /** * Returns the currently configured types. * - * @return string[] + * @return array */ public function getDefaults(): array { @@ -95,7 +95,7 @@ public function getDefaults(): array * * If a key already exists it will not be overwritten. * - * @param string[] $types The additional types to add. + * @param array $types The additional types to add. * @return void */ public function addDefaults(array $types): void @@ -114,7 +114,7 @@ public function addDefaults(array $types): void * * This method will replace all the existing type maps with the ones provided. * - * @param string[] $types Associative array where keys are field names and values + * @param array $types Associative array where keys are field names and values * are the correspondent type. * @return $this */ @@ -128,7 +128,7 @@ public function setTypes(array $types) /** * Gets a map of fields and their associated types for single-use. * - * @return string[] + * @return array */ public function getTypes(): array { @@ -145,20 +145,13 @@ public function getTypes(): array */ public function type($column): ?string { - if (isset($this->_types[$column])) { - return $this->_types[$column]; - } - if (isset($this->_defaults[$column])) { - return $this->_defaults[$column]; - } - - return null; + return $this->_types[$column] ?? $this->_defaults[$column] ?? null; } /** * Returns an array of all types mapped types * - * @return string[] + * @return array */ public function toArray(): array { diff --git a/app/vendor/cakephp/cakephp/src/Database/TypeMapTrait.php b/app/vendor/cakephp/cakephp/src/Database/TypeMapTrait.php index e893c593..d3307093 100644 --- a/app/vendor/cakephp/cakephp/src/Database/TypeMapTrait.php +++ b/app/vendor/cakephp/cakephp/src/Database/TypeMapTrait.php @@ -32,7 +32,7 @@ trait TypeMapTrait /** * Creates a new TypeMap if $typeMap is an array, otherwise exchanges it for the given one. * - * @param array|\Cake\Database\TypeMap $typeMap Creates a TypeMap if array, otherwise sets the given TypeMap + * @param \Cake\Database\TypeMap|array $typeMap Creates a TypeMap if array, otherwise sets the given TypeMap * @return $this */ public function setTypeMap($typeMap) @@ -66,7 +66,7 @@ public function getTypeMap(): TypeMap * To add a default without overwriting existing ones * use `getTypeMap()->addDefaults()` * - * @param array $types The array of types to set. + * @param array $types The array of types to set. * @return $this * @see \Cake\Database\TypeMap::setDefaults() */ @@ -80,7 +80,7 @@ public function setDefaultTypes(array $types) /** * Gets default types of current type map. * - * @return array + * @return array */ public function getDefaultTypes(): array { diff --git a/app/vendor/cakephp/cakephp/src/Datasource/ConnectionManager.php b/app/vendor/cakephp/cakephp/src/Datasource/ConnectionManager.php index 44bf79ec..54adf540 100644 --- a/app/vendor/cakephp/cakephp/src/Datasource/ConnectionManager.php +++ b/app/vendor/cakephp/cakephp/src/Datasource/ConnectionManager.php @@ -43,14 +43,14 @@ class ConnectionManager /** * A map of connection aliases. * - * @var string[] + * @var array */ protected static $_aliasMap = []; /** * An array mapping url schemes to fully qualified driver class names * - * @var string[] + * @var array * @psalm-var array */ protected static $_dsnClassMap = [ @@ -72,8 +72,8 @@ class ConnectionManager * * The connection will not be constructed until it is first used. * - * @param string|array $key The name of the connection config, or an array of multiple configs. - * @param array|null $config An array of name => config data for adapter. + * @param array|string $key The name of the connection config, or an array of multiple configs. + * @param array|null $config An array of name => config data for adapter. * @return void * @throws \Cake\Core\Exception\CakeException When trying to modify an existing config. * @see \Cake\Core\StaticConfigTrait::config() @@ -110,7 +110,7 @@ public static function setConfig($key, $config = null): void * Note that query-string arguments are also parsed and set as values in the returned configuration. * * @param string $config The DSN string to convert to a configuration array - * @return array The configuration array to be stored after parsing the DSN + * @return array The configuration array to be stored after parsing the DSN */ public static function parseDsn(string $config): array { @@ -150,20 +150,13 @@ public static function parseDsn(string $config): array * ConnectionManager::alias('test_things', 'things'); * ``` * - * @param string $alias The alias to add. Fetching $source will return $alias when loaded with get. - * @param string $source The connection to add an alias to. + * @param string $source The existing connection to alias. + * @param string $alias The alias name that resolves to `$source`. * @return void - * @throws \Cake\Datasource\Exception\MissingDatasourceConfigException When aliasing a - * connection that does not exist. */ - public static function alias(string $alias, string $source): void + public static function alias(string $source, string $alias): void { - if (empty(static::$_config[$source]) && empty(static::$_config[$alias])) { - throw new MissingDatasourceConfigException( - sprintf('Cannot create alias of "%s" as it does not exist.', $alias) - ); - } - static::$_aliasMap[$source] = $alias; + static::$_aliasMap[$alias] = $source; } /** @@ -172,12 +165,12 @@ public static function alias(string $alias, string $source): void * Removes an alias from ConnectionManager. Fetching the aliased * connection may fail if there is no other connection with that name. * - * @param string $name The connection name to remove aliases for. + * @param string $alias The connection alias to drop * @return void */ - public static function dropAlias(string $name): void + public static function dropAlias(string $alias): void { - unset(static::$_aliasMap[$name]); + unset(static::$_aliasMap[$alias]); } /** @@ -202,13 +195,12 @@ public static function get(string $name, bool $useAliases = true) if (empty(static::$_config[$name])) { throw new MissingDatasourceConfigException(['name' => $name]); } - if (empty(static::$_registry)) { + /** @psalm-suppress RedundantPropertyInitializationCheck */ + if (!isset(static::$_registry)) { static::$_registry = new ConnectionRegistry(); } - if (isset(static::$_registry->{$name})) { - return static::$_registry->{$name}; - } - return static::$_registry->load($name, static::$_config[$name]); + return static::$_registry->{$name} + ?? static::$_registry->load($name, static::$_config[$name]); } } diff --git a/app/vendor/cakephp/cakephp/src/Datasource/ConnectionRegistry.php b/app/vendor/cakephp/cakephp/src/Datasource/ConnectionRegistry.php index 9bedc016..34a5aca5 100644 --- a/app/vendor/cakephp/cakephp/src/Datasource/ConnectionRegistry.php +++ b/app/vendor/cakephp/cakephp/src/Datasource/ConnectionRegistry.php @@ -68,9 +68,9 @@ protected function _throwMissingClassError(string $class, ?string $plugin): void * If a callable is passed as first argument, The returned value of this * function will be the result of the callable. * - * @param string|\Cake\Datasource\ConnectionInterface|callable $class The classname or object to make. + * @param \Cake\Datasource\ConnectionInterface|callable|string $class The classname or object to make. * @param string $alias The alias of the object. - * @param array $config An array of settings to use for the datasource. + * @param array $config An array of settings to use for the datasource. * @return \Cake\Datasource\ConnectionInterface A connection with the correct settings. */ protected function _create($class, string $alias, array $config) diff --git a/app/vendor/cakephp/cakephp/src/Datasource/EntityInterface.php b/app/vendor/cakephp/cakephp/src/Datasource/EntityInterface.php index 146ad0dc..c0991064 100644 --- a/app/vendor/cakephp/cakephp/src/Datasource/EntityInterface.php +++ b/app/vendor/cakephp/cakephp/src/Datasource/EntityInterface.php @@ -31,7 +31,7 @@ interface EntityInterface extends ArrayAccess, JsonSerializable /** * Sets hidden fields. * - * @param string[] $fields An array of fields to hide from array exports. + * @param array $fields An array of fields to hide from array exports. * @param bool $merge Merge the new fields with the existing. By default false. * @return $this */ @@ -40,14 +40,14 @@ public function setHidden(array $fields, bool $merge = false); /** * Gets the hidden fields. * - * @return string[] + * @return array */ public function getHidden(): array; /** * Sets the virtual fields on this entity. * - * @param string[] $fields An array of fields to treat as virtual. + * @param array $fields An array of fields to treat as virtual. * @param bool $merge Merge the new fields with the existing. By default false. * @return $this */ @@ -56,7 +56,7 @@ public function setVirtual(array $fields, bool $merge = false); /** * Gets the virtual fields on this entity. * - * @return string[] + * @return array */ public function getVirtual(): array; @@ -81,7 +81,7 @@ public function isDirty(?string $field = null): bool; /** * Gets the dirty fields. * - * @return string[] + * @return array */ public function getDirty(): array; @@ -112,7 +112,7 @@ public function getError(string $field): array; * Sets error messages to the entity * * @param array $errors The array of errors to set. - * @param bool $overwrite Whether or not to overwrite pre-existing errors for $fields + * @param bool $overwrite Whether to overwrite pre-existing errors for $fields * @return $this */ public function setErrors(array $errors, bool $overwrite = false); @@ -121,16 +121,16 @@ public function setErrors(array $errors, bool $overwrite = false); * Sets errors for a single field * * @param string $field The field to get errors for, or the array of errors to set. - * @param string|array $errors The errors to be set for $field - * @param bool $overwrite Whether or not to overwrite pre-existing errors for $field + * @param array|string $errors The errors to be set for $field + * @param bool $overwrite Whether to overwrite pre-existing errors for $field * @return $this */ public function setError(string $field, $errors, bool $overwrite = false); /** - * Stores whether or not a field value can be changed or set in this entity. + * Stores whether a field value can be changed or set in this entity. * - * @param string|array $field single or list of fields to change its accessibility + * @param array|string $field single or list of fields to change its accessibility * @param bool $set true marks the field as accessible, false will * mark it as protected. * @return $this @@ -164,7 +164,7 @@ public function getSource(): string; * Returns an array with the requested original fields * stored in this entity, indexed by field name. * - * @param string[] $fields List of fields to be returned + * @param array $fields List of fields to be returned * @return array */ public function extractOriginal(array $fields): array; @@ -173,7 +173,7 @@ public function extractOriginal(array $fields): array; * Returns an array with only the original fields * stored in this entity, indexed by field name. * - * @param string[] $fields List of fields to be returned + * @param array $fields List of fields to be returned * @return array */ public function extractOriginalChanged(array $fields): array; @@ -181,11 +181,11 @@ public function extractOriginalChanged(array $fields): array; /** * Sets one or multiple fields to the specified value * - * @param string|array $field the name of field to set or a list of + * @param array|string $field the name of field to set or a list of * fields with their respective values * @param mixed $value The value to set to the field or an array if the * first argument is also an array, in which case will be treated as $options - * @param array $options options to be used for setting the field. Allowed option + * @param array $options Options to be used for setting the field. Allowed option * keys are `setter` and `guard` * @return $this */ @@ -216,9 +216,9 @@ public function getOriginalValues(): array; /** * Returns whether this entity contains a field named $field - * regardless of if it is empty. + * and is not set to null. * - * @param string|string[] $field The field to check. + * @param array|string $field The field to check. * @return bool */ public function has($field): bool; @@ -226,7 +226,7 @@ public function has($field): bool; /** * Removes a field or list of fields from this entity * - * @param string|string[] $field The field to unset. + * @param array|string $field The field to unset. * @return $this */ public function unset($field); @@ -234,7 +234,7 @@ public function unset($field); /** * Get the list of visible fields. * - * @return string[] A list of fields that are 'visible' in all representations. + * @return array A list of fields that are 'visible' in all representations. */ public function getVisible(): array; @@ -252,7 +252,7 @@ public function toArray(): array; * Returns an array with the requested fields * stored in this entity, indexed by field name * - * @param string[] $fields list of fields to be returned + * @param array $fields list of fields to be returned * @param bool $onlyDirty Return the requested field only if it is dirty * @return array */ @@ -273,15 +273,15 @@ public function clean(): void; * Using `true` means that the entity has not been persisted in the database, * `false` indicates that the entity has been persisted. * - * @param bool $new Indicate whether or not this entity has been persisted. + * @param bool $new Indicate whether this entity has been persisted. * @return $this */ public function setNew(bool $new); /** - * Returns whether or not this entity has already been persisted. + * Returns whether this entity has already been persisted. * - * @return bool Whether or not the entity has been persisted. + * @return bool Whether the entity has been persisted. */ public function isNew(): bool; } diff --git a/app/vendor/cakephp/cakephp/src/Datasource/EntityTrait.php b/app/vendor/cakephp/cakephp/src/Datasource/EntityTrait.php index 7c54bce0..a18b4cde 100644 --- a/app/vendor/cakephp/cakephp/src/Datasource/EntityTrait.php +++ b/app/vendor/cakephp/cakephp/src/Datasource/EntityTrait.php @@ -32,14 +32,14 @@ trait EntityTrait /** * Holds all fields and their values for this entity. * - * @var array + * @var array */ protected $_fields = []; /** * Holds all fields that have been changed and their original values for this entity. * - * @var array + * @var array */ protected $_original = []; @@ -47,7 +47,7 @@ trait EntityTrait * List of field names that should **not** be included in JSON or Array * representations of this Entity. * - * @var string[] + * @var array */ protected $_hidden = []; @@ -56,7 +56,7 @@ trait EntityTrait * representations of this Entity. If a field is present in both _hidden and _virtual * the field will **not** be in the array/JSON versions of the entity. * - * @var string[] + * @var array */ protected $_virtual = []; @@ -64,19 +64,19 @@ trait EntityTrait * Holds a list of the fields that were modified or added after this object * was originally created. * - * @var bool[] + * @var array */ protected $_dirty = []; /** * Holds a cached list of getters/setters per class * - * @var array + * @var array>> */ protected static $_accessors = []; /** - * Indicates whether or not this entity is yet to be persisted. + * Indicates whether this entity is yet to be persisted. * Entities default to assuming they are new. You can use Table::persisted() * to set the new flag on an entity based on records in the database. * @@ -87,14 +87,14 @@ trait EntityTrait /** * List of errors per field as stored in this object. * - * @var array + * @var array */ protected $_errors = []; /** * List of invalid fields and their data for errors upon validation/patching. * - * @var array + * @var array */ protected $_invalid = []; @@ -107,7 +107,7 @@ trait EntityTrait * not defined in the map will take its value. For example, `'*' => true` * means that any field not defined in the map will be accessible by default * - * @var bool[] + * @var array */ protected $_accessible = ['*' => true]; @@ -143,7 +143,7 @@ public function __set(string $field, $value): void /** * Returns whether this entity contains a field named $field - * regardless of if it is empty. + * and is not set to null. * * @param string $field The field to check. * @return bool @@ -210,11 +210,11 @@ public function __unset(string $field): void * $entity->set('name', 'Andrew'); * ``` * - * @param string|array $field the name of field to set or a list of + * @param array|string $field the name of field to set or a list of * fields with their respective values * @param mixed $value The value to set to the field or an array if the * first argument is also an array, in which case will be treated as $options - * @param array $options options to be used for setting the field. Allowed option + * @param array $options Options to be used for setting the field. Allowed option * keys are `setter` and `guard` * @return $this * @throws \InvalidArgumentException @@ -303,7 +303,7 @@ public function &get(string $field) */ public function getOriginal(string $field) { - if (!strlen($field)) { + if ($field === '') { throw new InvalidArgumentException('Cannot get an empty field'); } if (array_key_exists($field, $this->_original)) { @@ -355,7 +355,7 @@ public function getOriginalValues(): array * When checking multiple fields. All fields must not be null * in order for true to be returned. * - * @param string|string[] $field The field or fields to check. + * @param array|string $field The field or fields to check. * @return bool */ public function has($field): bool @@ -405,7 +405,7 @@ public function isEmpty(string $field): bool } /** - * Checks tha a field has a value. + * Checks that a field has a value. * * This method will return true for * @@ -435,7 +435,7 @@ public function hasValue(string $field): bool * $entity->unset(['name', 'last_name']); * ``` * - * @param string|string[] $field The field to unset. + * @param array|string $field The field to unset. * @return $this */ public function unset($field) @@ -452,7 +452,7 @@ public function unset($field) * Removes a field or list of fields from this entity * * @deprecated 4.0.0 Use {@link unset()} instead. Will be removed in 5.0. - * @param string|string[] $field The field to unset. + * @param array|string $field The field to unset. * @return $this */ public function unsetProperty($field) @@ -465,7 +465,7 @@ public function unsetProperty($field) /** * Sets hidden fields. * - * @param string[] $fields An array of fields to hide from array exports. + * @param array $fields An array of fields to hide from array exports. * @param bool $merge Merge the new fields with the existing. By default false. * @return $this */ @@ -486,7 +486,7 @@ public function setHidden(array $fields, bool $merge = false) /** * Gets the hidden fields. * - * @return string[] + * @return array */ public function getHidden(): array { @@ -496,7 +496,7 @@ public function getHidden(): array /** * Sets the virtual fields on this entity. * - * @param string[] $fields An array of fields to treat as virtual. + * @param array $fields An array of fields to treat as virtual. * @param bool $merge Merge the new fields with the existing. By default false. * @return $this */ @@ -517,7 +517,7 @@ public function setVirtual(array $fields, bool $merge = false) /** * Gets the virtual fields on this entity. * - * @return string[] + * @return array */ public function getVirtual(): array { @@ -530,7 +530,7 @@ public function getVirtual(): array * The list of visible fields is all standard fields * plus virtual fields minus hidden fields. * - * @return string[] A list of fields that are 'visible' in all + * @return array A list of fields that are 'visible' in all * representations. */ public function getVisible(): array @@ -601,6 +601,7 @@ public function offsetExists($offset): bool * @param string $offset The offset to get. * @return mixed */ + #[\ReturnTypeWillChange] public function &offsetGet($offset) { return $this->get($offset); @@ -677,7 +678,7 @@ protected static function _accessor(string $property, string $type): string * Returns an array with the requested fields * stored in this entity, indexed by field name * - * @param string[] $fields list of fields to be returned + * @param array $fields list of fields to be returned * @param bool $onlyDirty Return the requested field only if it is dirty * @return array */ @@ -700,7 +701,7 @@ public function extract(array $fields, bool $onlyDirty = false): array * Fields that are unchanged from their original value will be included in the * return of this method. * - * @param string[] $fields List of fields to be returned + * @param array $fields List of fields to be returned * @return array */ public function extractOriginal(array $fields): array @@ -720,7 +721,7 @@ public function extractOriginal(array $fields): array * This method will only return fields that have been modified since * the entity was built. Unchanged fields will be omitted. * - * @param string[] $fields List of fields to be returned + * @param array $fields List of fields to be returned * @return array */ public function extractOriginalChanged(array $fields): array @@ -776,7 +777,7 @@ public function isDirty(?string $field = null): bool /** * Gets the dirty fields. * - * @return string[] + * @return array */ public function getDirty(): array { @@ -804,7 +805,7 @@ public function clean(): void * Using `true` means that the entity has not been persisted in the database, * `false` that it already is. * - * @param bool $new Indicate whether or not this entity has been persisted. + * @param bool $new Indicate whether this entity has been persisted. * @return $this */ public function setNew(bool $new) @@ -821,9 +822,9 @@ public function setNew(bool $new) } /** - * Returns whether or not this entity has already been persisted. + * Returns whether this entity has already been persisted. * - * @return bool Whether or not the entity has been persisted. + * @return bool Whether the entity has been persisted. */ public function isNew(): bool { @@ -908,7 +909,7 @@ public function getError(string $field): array * ``` * * @param array $errors The array of errors to set. - * @param bool $overwrite Whether or not to overwrite pre-existing errors for $fields + * @param bool $overwrite Whether to overwrite pre-existing errors for $fields * @return $this */ public function setErrors(array $errors, bool $overwrite = false) @@ -950,8 +951,8 @@ public function setErrors(array $errors, bool $overwrite = false) * ``` * * @param string $field The field to get errors for, or the array of errors to set. - * @param string|array $errors The errors to be set for $field - * @param bool $overwrite Whether or not to overwrite pre-existing errors for $field + * @param array|string $errors The errors to be set for $field + * @param bool $overwrite Whether to overwrite pre-existing errors for $field * @return $this */ public function setError(string $field, $errors, bool $overwrite = false) @@ -1017,7 +1018,7 @@ protected function _nestedErrors(string $field): array /** * Reads if there are errors for one or many objects. * - * @param array|\Cake\Datasource\EntityInterface $object The object to read errors from. + * @param \Cake\Datasource\EntityInterface|array $object The object to read errors from. * @return bool */ protected function _readHasErrors($object): bool @@ -1040,7 +1041,7 @@ protected function _readHasErrors($object): bool /** * Read the error(s) from one or many objects. * - * @param iterable|\Cake\Datasource\EntityInterface $object The object to read errors from. + * @param \Cake\Datasource\EntityInterface|iterable $object The object to read errors from. * @param string|null $path The field name for errors. * @return array */ @@ -1057,6 +1058,8 @@ protected function _readError($object, $path = null): array if ($val instanceof EntityInterface) { return $val->getErrors(); } + + return null; }, (array)$object); return array_filter($array); @@ -1094,7 +1097,7 @@ public function getInvalidField(string $field) * purposes or to be able to log it away. * * @param array $fields The values to set. - * @param bool $overwrite Whether or not to overwrite pre-existing values for $field. + * @param bool $overwrite Whether to overwrite pre-existing values for $field. * @return $this */ public function setInvalid(array $fields, bool $overwrite = false) @@ -1125,7 +1128,7 @@ public function setInvalidField(string $field, $value) } /** - * Stores whether or not a field value can be changed or set in this entity. + * Stores whether a field value can be changed or set in this entity. * The special field `*` can also be marked as accessible or protected, meaning * that any other field specified before will take its value. For example * `$entity->setAccess('*', true)` means that any field not specified already @@ -1143,7 +1146,7 @@ public function setInvalidField(string $field, $value) * $entity->setAccess('*', false); // Mark all fields as protected * ``` * - * @param string|array $field Single or list of fields to change its accessibility + * @param array|string $field Single or list of fields to change its accessibility * @param bool $set True marks the field as accessible, false will * mark it as protected. * @return $this @@ -1170,7 +1173,7 @@ public function setAccess($field, bool $set) * Returns the raw accessible configuration for this entity. * The `*` wildcard refers to all fields. * - * @return bool[] + * @return array */ public function getAccessible(): array { @@ -1233,7 +1236,7 @@ public function __toString(): string * Returns an array that can be used to describe the internal state of this * object. * - * @return array + * @return array */ public function __debugInfo(): array { diff --git a/app/vendor/cakephp/cakephp/src/Datasource/FactoryLocator.php b/app/vendor/cakephp/cakephp/src/Datasource/FactoryLocator.php index f410e88a..27eef3d0 100644 --- a/app/vendor/cakephp/cakephp/src/Datasource/FactoryLocator.php +++ b/app/vendor/cakephp/cakephp/src/Datasource/FactoryLocator.php @@ -28,7 +28,7 @@ class FactoryLocator /** * A list of model factory functions. * - * @var (callable|\Cake\Datasource\Locator\LocatorInterface)[] + * @var array */ protected static $_modelFactories = []; @@ -36,7 +36,7 @@ class FactoryLocator * Register a callable to generate repositories of a given type. * * @param string $type The name of the repository type the factory function is for. - * @param callable|\Cake\Datasource\Locator\LocatorInterface $factory The factory function used to create instances. + * @param \Cake\Datasource\Locator\LocatorInterface|callable $factory The factory function used to create instances. * @return void */ public static function add(string $type, $factory): void @@ -68,7 +68,7 @@ public static function drop(string $type): void * * @param string $type The repository type to get the factory for. * @throws \InvalidArgumentException If the specified repository type has no factory. - * @return callable|\Cake\Datasource\Locator\LocatorInterface The factory for the repository type. + * @return \Cake\Datasource\Locator\LocatorInterface|callable The factory for the repository type. */ public static function get(string $type) { diff --git a/app/vendor/cakephp/cakephp/src/Datasource/InvalidPropertyInterface.php b/app/vendor/cakephp/cakephp/src/Datasource/InvalidPropertyInterface.php index 2c2da610..0c94a53e 100644 --- a/app/vendor/cakephp/cakephp/src/Datasource/InvalidPropertyInterface.php +++ b/app/vendor/cakephp/cakephp/src/Datasource/InvalidPropertyInterface.php @@ -37,7 +37,7 @@ public function getInvalid(): array; * purposes or to be able to log it away. * * @param array $fields The values to set. - * @param bool $overwrite Whether or not to overwrite pre-existing values for $field. + * @param bool $overwrite Whether to overwrite pre-existing values for $field. * @return $this */ public function setInvalid(array $fields, bool $overwrite = false); diff --git a/app/vendor/cakephp/cakephp/src/Datasource/Locator/AbstractLocator.php b/app/vendor/cakephp/cakephp/src/Datasource/Locator/AbstractLocator.php index 5fa87a70..4bf00a81 100644 --- a/app/vendor/cakephp/cakephp/src/Datasource/Locator/AbstractLocator.php +++ b/app/vendor/cakephp/cakephp/src/Datasource/Locator/AbstractLocator.php @@ -27,19 +27,25 @@ abstract class AbstractLocator implements LocatorInterface /** * Instances that belong to the registry. * - * @var \Cake\Datasource\RepositoryInterface[] + * @var array */ protected $instances = []; /** * Contains a list of options that were passed to get() method. * - * @var array + * @var array */ protected $options = []; /** - * @inheritDoc + * {@inheritDoc} + * + * @param string $alias The alias name you want to get. + * @param array $options The options you want to build the table with. + * @return \Cake\Datasource\RepositoryInterface + * @throws \RuntimeException When trying to get alias for which instance + * has already been created with different options. */ public function get(string $alias, array $options = []) { @@ -66,7 +72,7 @@ public function get(string $alias, array $options = []) * Create an instance of a given classname. * * @param string $alias Repository alias. - * @param array $options The options you want to build the instance with. + * @param array $options The options you want to build the instance with. * @return \Cake\Datasource\RepositoryInterface */ abstract protected function createInstance(string $alias, array $options); diff --git a/app/vendor/cakephp/cakephp/src/Datasource/Locator/LocatorInterface.php b/app/vendor/cakephp/cakephp/src/Datasource/Locator/LocatorInterface.php index 1d63a456..256ae0a1 100644 --- a/app/vendor/cakephp/cakephp/src/Datasource/Locator/LocatorInterface.php +++ b/app/vendor/cakephp/cakephp/src/Datasource/Locator/LocatorInterface.php @@ -27,7 +27,7 @@ interface LocatorInterface * Get a repository instance from the registry. * * @param string $alias The alias name you want to get. - * @param array $options The options you want to build the table with. + * @param array $options The options you want to build the table with. * @return \Cake\Datasource\RepositoryInterface * @throws \RuntimeException When trying to get alias for which instance * has already been created with different options. diff --git a/app/vendor/cakephp/cakephp/src/Datasource/ModelAwareTrait.php b/app/vendor/cakephp/cakephp/src/Datasource/ModelAwareTrait.php index e21be229..b890cbf3 100644 --- a/app/vendor/cakephp/cakephp/src/Datasource/ModelAwareTrait.php +++ b/app/vendor/cakephp/cakephp/src/Datasource/ModelAwareTrait.php @@ -27,6 +27,8 @@ * * Example users of this trait are Cake\Controller\Controller and * Cake\Console\Shell. + * + * @deprecated 4.3.0 Use `Cake\ORM\Locator\LocatorAwareTrait` instead. */ trait ModelAwareTrait { @@ -42,13 +44,14 @@ trait ModelAwareTrait * controller name. * * @var string|null + * @deprecated 4.3.0 Use `Cake\ORM\Locator\LocatorAwareTrait::$defaultTable` instead. */ protected $modelClass; /** * A list of overridden model factory functions. * - * @var (callable|\Cake\Datasource\Locator\LocatorInterface)[] + * @var array */ protected $_modelFactories = []; @@ -90,6 +93,7 @@ protected function _setModelClass(string $name): void * @throws \Cake\Datasource\Exception\MissingModelException If the model class cannot be found. * @throws \UnexpectedValueException If $modelClass argument is not provided * and ModelAwareTrait::$modelClass property value is empty. + * @deprecated 4.3.0 Use `LocatorAwareTrait::fetchTable()` instead. */ public function loadModel(?string $modelClass = null, ?string $modelType = null): RepositoryInterface { @@ -135,7 +139,7 @@ public function loadModel(?string $modelClass = null, ?string $modelType = null) * Override a existing callable to generate repositories of a given type. * * @param string $type The name of the repository type the factory function is for. - * @param callable|\Cake\Datasource\Locator\LocatorInterface $factory The factory function used to create instances. + * @param \Cake\Datasource\Locator\LocatorInterface|callable $factory The factory function used to create instances. * @return void */ public function modelFactory(string $type, $factory): void diff --git a/app/vendor/cakephp/cakephp/src/Datasource/Paginator.php b/app/vendor/cakephp/cakephp/src/Datasource/Paginator.php index 3cabf61d..d842cd90 100644 --- a/app/vendor/cakephp/cakephp/src/Datasource/Paginator.php +++ b/app/vendor/cakephp/cakephp/src/Datasource/Paginator.php @@ -40,7 +40,7 @@ class Paginator implements PaginatorInterface * parameters. Modifying this list will allow users to have more influence * over pagination, be careful with what you permit. * - * @var array + * @var array */ protected $_defaultConfig = [ 'page' => 1, @@ -199,10 +199,10 @@ public function paginate(object $object, array $params = [], array $settings = [ * * @param \Cake\Datasource\RepositoryInterface $object Repository instance. * @param \Cake\Datasource\QueryInterface|null $query Query Instance. - * @param array $data Pagination data. + * @param array $data Pagination data. * @return \Cake\Datasource\QueryInterface */ - protected function getQuery(RepositoryInterface $object, ?QueryInterface $query = null, array $data): QueryInterface + protected function getQuery(RepositoryInterface $object, ?QueryInterface $query, array $data): QueryInterface { if ($query === null) { $query = $object->find($data['finder'], $data['options']); @@ -229,8 +229,8 @@ protected function getCount(QueryInterface $query, array $data): ?int * Extract pagination data needed * * @param \Cake\Datasource\RepositoryInterface $object The repository object. - * @param array $params Request params - * @param array $settings The settings/configuration used for pagination. + * @param array $params Request params + * @param array $settings The settings/configuration used for pagination. * @return array Array with keys 'defaults', 'options' and 'finder' */ protected function extractData(RepositoryInterface $object, array $params, array $settings): array @@ -251,9 +251,9 @@ protected function extractData(RepositoryInterface $object, array $params, array /** * Build pagination params. * - * @param array $data Paginator data containing keys 'options', + * @param array $data Paginator data containing keys 'options', * 'count', 'defaults', 'finder', 'numResults'. - * @return array Paging params. + * @return array Paging params. */ protected function buildParams(array $data): array { @@ -284,9 +284,9 @@ protected function buildParams(array $data): array /** * Add "page" and "pageCount" params. * - * @param array $params Paging params. + * @param array $params Paging params. * @param array $data Paginator data. - * @return array Updated params. + * @return array Updated params. */ protected function addPageCountParams(array $params, array $data): array { @@ -309,9 +309,9 @@ protected function addPageCountParams(array $params, array $data): array /** * Add "start" and "end" params. * - * @param array $params Paging params. + * @param array $params Paging params. * @param array $data Paginator data. - * @return array Updated params. + * @return array Updated params. */ protected function addStartEndParams(array $params, array $data): array { @@ -331,9 +331,9 @@ protected function addStartEndParams(array $params, array $data): array /** * Add "prevPage" and "nextPage" params. * - * @param array $params Paginator params. + * @param array $params Paginator params. * @param array $data Paging data. - * @return array Updated params. + * @return array Updated params. */ protected function addPrevNextParams(array $params, array $data): array { @@ -350,9 +350,9 @@ protected function addPrevNextParams(array $params, array $data): array /** * Add sorting / ordering params. * - * @param array $params Paginator params. + * @param array $params Paginator params. * @param array $data Paging data. - * @return array Updated params. + * @return array Updated params. */ protected function addSortingParams(array $params, array $data): array { @@ -379,7 +379,7 @@ protected function addSortingParams(array $params, array $data): array /** * Extracts the finder name and options out of the provided pagination options. * - * @param array $options the pagination options. + * @param array $options the pagination options. * @return array An array containing in the first position the finder name * and in the second the options to be passed to it. */ @@ -409,7 +409,7 @@ public function getPagingParams(): array /** * Shim method for reading the deprecated whitelist or allowedParameters options * - * @return string[] + * @return array */ protected function getAllowedParameters(): array { @@ -430,8 +430,8 @@ protected function getAllowedParameters(): array /** * Shim method for reading the deprecated sortWhitelist or sortableFields options. * - * @param array $config The configuration data to coalesce and emit warnings on. - * @return string[]|null + * @param array $config The configuration data to coalesce and emit warnings on. + * @return array|null */ protected function getSortableFields(array $config): ?array { @@ -459,9 +459,9 @@ protected function getSortableFields(array $config): ?array * combined together. You can change config value `allowedParameters` to modify * which options/values can be set using request parameters. * - * @param array $params Request params. + * @param array $params Request params. * @param array $settings The settings to merge with the request data. - * @return array Array of merged options. + * @return array Array of merged options. */ public function mergeOptions(array $params, array $settings): array { @@ -481,8 +481,8 @@ public function mergeOptions(array $params, array $settings): array * repository, the general settings will be used. * * @param string $alias Model name to get settings for. - * @param array $settings The settings which is used for combining. - * @return array An array of pagination settings for a model, + * @param array $settings The settings which is used for combining. + * @return array An array of pagination settings for a model, * or the general settings. */ public function getDefaults(string $alias, array $settings): array @@ -529,8 +529,8 @@ public function getDefaults(string $alias, array $settings): array * requested sorting field/direction. * * @param \Cake\Datasource\RepositoryInterface $object Repository object. - * @param array $options The pagination options being used for this request. - * @return array An array of options with sort + direction removed and + * @param array $options The pagination options being used for this request. + * @return array An array of options with sort + direction removed and * replaced with order if possible. */ public function validateSort(RepositoryInterface $object, array $options): array @@ -593,9 +593,9 @@ public function validateSort(RepositoryInterface $object, array $options): array /** * Remove alias if needed. * - * @param array $fields Current fields + * @param array $fields Current fields * @param string $model Current model alias - * @return array $fields Unaliased fields where applicable + * @return array $fields Unaliased fields where applicable */ protected function _removeAliases(array $fields, string $model): array { @@ -624,7 +624,7 @@ protected function _removeAliases(array $fields, string $model): array * * @param \Cake\Datasource\RepositoryInterface $object Repository object. * @param array $order Order array. - * @param bool $allowed Whether or not the field was allowed. + * @param bool $allowed Whether the field was allowed. * @return array Final order array. */ protected function _prefix(RepositoryInterface $object, array $order, bool $allowed = false): array @@ -663,8 +663,8 @@ protected function _prefix(RepositoryInterface $object, array $order, bool $allo /** * Check the limit parameter and ensure it's within the maxLimit bounds. * - * @param array $options An array of options with a limit key to be checked. - * @return array An array of options for pagination. + * @param array $options An array of options with a limit key to be checked. + * @return array An array of options for pagination. */ public function checkLimit(array $options): array { diff --git a/app/vendor/cakephp/cakephp/src/Datasource/QueryCacher.php b/app/vendor/cakephp/cakephp/src/Datasource/QueryCacher.php index ab5ddf54..c421f91b 100644 --- a/app/vendor/cakephp/cakephp/src/Datasource/QueryCacher.php +++ b/app/vendor/cakephp/cakephp/src/Datasource/QueryCacher.php @@ -25,7 +25,7 @@ /** * Handles caching queries and loading results from the cache. * - * Used by Cake\Datasource\QueryTrait internally. + * Used by {@link \Cake\Datasource\QueryTrait} internally. * * @internal * @see \Cake\Datasource\QueryTrait::cache() for the public interface. @@ -35,22 +35,22 @@ class QueryCacher /** * The key or function to generate a key. * - * @var string|\Closure + * @var \Closure|string */ protected $_key; /** * Config for cache engine. * - * @var string|\Psr\SimpleCache\CacheInterface + * @var \Psr\SimpleCache\CacheInterface|string */ protected $_config; /** * Constructor. * - * @param string|\Closure $key The key or function to generate a key. - * @param string|\Psr\SimpleCache\CacheInterface $config The cache config name or cache engine instance. + * @param \Closure|string $key The key or function to generate a key. + * @param \Psr\SimpleCache\CacheInterface|string $config The cache config name or cache engine instance. * @throws \RuntimeException */ public function __construct($key, $config) diff --git a/app/vendor/cakephp/cakephp/src/Datasource/QueryInterface.php b/app/vendor/cakephp/cakephp/src/Datasource/QueryInterface.php index 9b3fc8f6..e3910526 100644 --- a/app/vendor/cakephp/cakephp/src/Datasource/QueryInterface.php +++ b/app/vendor/cakephp/cakephp/src/Datasource/QueryInterface.php @@ -36,7 +36,7 @@ interface QueryInterface * If `true` is passed in the second argument, any previous selections will * be overwritten with the list passed in the first argument. * - * @param array|string|callable|\Cake\Database\ExpressionInterface|\Cake\ORM\Table|\Cake\ORM\Association $fields Fields. + * @param \Cake\Database\ExpressionInterface|\Cake\ORM\Association|\Cake\ORM\Table|callable|array|string $fields Fields. * @param bool $overwrite whether to reset fields with passed list or not * @return $this */ @@ -62,7 +62,7 @@ public function aliasField(string $field, ?string $alias = null): array; * * @param array $fields The fields to alias * @param string|null $defaultAlias The default alias - * @return string[] + * @return array */ public function aliasFields(array $fields, ?string $defaultAlias = null): array; @@ -115,7 +115,7 @@ public function all(): ResultSetInterface; * ->limit(10) * ``` * - * @param array $options list of query clauses to apply new parts to. + * @param array $options list of query clauses to apply new parts to. * @return $this */ public function applyOptions(array $options); @@ -133,7 +133,7 @@ public function applyOptions(array $options); * a single query. * * @param string $finder The finder method to use. - * @param array $options The options for the finder. + * @param array $options The options for the finder. * @return static Returns a modified query. */ public function find(string $finder, array $options = []); @@ -172,10 +172,10 @@ public function count(): int; * $query->limit($query->newExpr()->add(['1 + 1'])); // LIMIT (1 + 1) * ``` * - * @param int|\Cake\Database\ExpressionInterface|null $num number of records to be returned + * @param \Cake\Database\ExpressionInterface|int|null $limit number of records to be returned * @return $this */ - public function limit($num); + public function limit($limit); /** * Sets the number of records that should be skipped from the original result set @@ -192,10 +192,10 @@ public function limit($num); * $query->offset($query->newExpr()->add(['1 + 1'])); // OFFSET (1 + 1) * ``` * - * @param int|\Cake\Database\ExpressionInterface|null $num number of records to be skipped + * @param \Cake\Database\ExpressionInterface|int|null $offset number of records to be skipped * @return $this */ - public function offset($num); + public function offset($offset); /** * Adds a single or multiple fields to be used in the ORDER clause for this query. @@ -242,7 +242,7 @@ public function offset($num); * If you need to set complex expressions as order conditions, you * should use `orderAsc()` or `orderDesc()`. * - * @param array|\Cake\Database\ExpressionInterface|\Closure|string $fields fields to be added to the list + * @param \Cake\Database\ExpressionInterface|\Closure|array|string $fields fields to be added to the list * @param bool $overwrite whether to reset order with field list or not * @return $this */ @@ -396,8 +396,8 @@ public function getRepository(): ?RepositoryInterface; * If you use string conditions make sure that your values are correctly quoted. * The safest thing you can do is to never use string conditions. * - * @param string|array|\Closure|null $conditions The conditions to filter on. - * @param array $types associative array of type names used to bind values to query + * @param \Closure|array|string|null $conditions The conditions to filter on. + * @param array $types Associative array of type names used to bind values to query * @param bool $overwrite whether to reset conditions with passed list or not * @return $this */ diff --git a/app/vendor/cakephp/cakephp/src/Datasource/QueryTrait.php b/app/vendor/cakephp/cakephp/src/Datasource/QueryTrait.php index 729cbdc6..dd950dd7 100644 --- a/app/vendor/cakephp/cakephp/src/Datasource/QueryTrait.php +++ b/app/vendor/cakephp/cakephp/src/Datasource/QueryTrait.php @@ -57,7 +57,7 @@ trait QueryTrait * List of formatter classes or callbacks that will post-process the * results when fetched * - * @var callable[] + * @var array */ protected $_formatters = []; @@ -136,6 +136,7 @@ public function setResult(iterable $results) * @return \Cake\Datasource\ResultSetInterface * @psalm-suppress ImplementedReturnTypeMismatch */ + #[\ReturnTypeWillChange] public function getIterator() { return $this->all(); @@ -173,7 +174,7 @@ public function getIterator() * * @param \Closure|string|false $key Either the cache key or a function to generate the cache key. * When using a function, this query instance will be supplied as an argument. - * @param string|\Psr\SimpleCache\CacheInterface $config Either the name of the cache config to use, or + * @param \Psr\SimpleCache\CacheInterface|string $config Either the name of the cache config to use, or * a cache engine instance. * @return $this */ @@ -203,7 +204,7 @@ public function isEagerLoaded(): bool * Sets the query instance to be an eager loaded query. If no argument is * passed, the current configured query `_eagerLoaded` value is returned. * - * @param bool $value Whether or not to eager load. + * @param bool $value Whether to eager load. * @return $this */ public function eagerLoaded(bool $value) @@ -227,21 +228,15 @@ public function eagerLoaded(bool $value) */ public function aliasField(string $field, ?string $alias = null): array { - $namespaced = strpos($field, '.') !== false; - $aliasedField = $field; - - if ($namespaced) { + if (strpos($field, '.') === false) { + $alias = $alias ?: $this->getRepository()->getAlias(); + $aliasedField = $alias . '.' . $field; + } else { + $aliasedField = $field; [$alias, $field] = explode('.', $field); } - if (!$alias) { - $alias = $this->getRepository()->getAlias(); - } - $key = sprintf('%s__%s', $alias, $field); - if (!$namespaced) { - $aliasedField = $alias . '.' . $field; - } return [$key => $aliasedField]; } @@ -252,7 +247,7 @@ public function aliasField(string $field, ?string $alias = null): array * * @param array $fields The fields to alias * @param string|null $defaultAlias The default alias - * @return string[] + * @return array */ public function aliasFields(array $fields, ?string $defaultAlias = null): array { @@ -441,7 +436,7 @@ public function getMapReducers(): array * ``` * * @param callable|null $formatter The formatting callable. - * @param int|true $mode Whether or not to overwrite, append or prepend the formatter. + * @param int|bool $mode Whether to overwrite, append or prepend the formatter. * @return $this * @throws \InvalidArgumentException */ @@ -472,7 +467,7 @@ public function formatResults(?callable $formatter = null, $mode = self::APPEND) /** * Returns the list of previously registered format routines. * - * @return callable[] + * @return array */ public function getResultFormatters(): array { @@ -553,6 +548,11 @@ public function __call(string $method, array $arguments) { $resultSetClass = $this->_decoratorClass(); if (in_array($method, get_class_methods($resultSetClass), true)) { + deprecationWarning(sprintf( + 'Calling result set method `%s()` directly on query instance is deprecated. ' . + 'You must call `all()` to retrieve the results first.', + $method + ), 2); $results = $this->all(); return $results->$method(...$arguments); @@ -566,7 +566,7 @@ public function __call(string $method, array $arguments) * Populates or adds parts to current query clauses using an array. * This is handy for passing all query clauses at once. * - * @param array $options the options to be applied + * @param array $options the options to be applied * @return $this */ abstract public function applyOptions(array $options); diff --git a/app/vendor/cakephp/cakephp/src/Datasource/RepositoryInterface.php b/app/vendor/cakephp/cakephp/src/Datasource/RepositoryInterface.php index b8ffbeb2..df4ed7d6 100644 --- a/app/vendor/cakephp/cakephp/src/Datasource/RepositoryInterface.php +++ b/app/vendor/cakephp/cakephp/src/Datasource/RepositoryInterface.php @@ -65,7 +65,7 @@ public function hasField(string $field): bool; * type of search that was selected. * * @param string $type the type of query to perform - * @param array $options An array that will be passed to Query::applyOptions() + * @param array $options An array that will be passed to Query::applyOptions() * @return \Cake\Datasource\QueryInterface */ public function find(string $type = 'all', array $options = []); @@ -84,7 +84,7 @@ public function find(string $type = 'all', array $options = []); * ``` * * @param mixed $primaryKey primary key value to find - * @param array $options options accepted by `Table::find()` + * @param array $options options accepted by `Table::find()` * @throws \Cake\Datasource\Exception\RecordNotFoundException if the record with such id * could not be found * @return \Cake\Datasource\EntityInterface @@ -106,7 +106,7 @@ public function query(); * This method will *not* trigger beforeSave/afterSave events. If you need those * first load a collection of records and update them. * - * @param string|array|\Closure|\Cake\Database\Expression\QueryExpression $fields A hash of field => new value. + * @param \Cake\Database\Expression\QueryExpression|\Closure|array|string $fields A hash of field => new value. * @param mixed $conditions Conditions to be used, accepts anything Query::where() * can take. * @return int Count Returns the affected rows. @@ -145,7 +145,7 @@ public function exists($conditions): bool; * of any error. * * @param \Cake\Datasource\EntityInterface $entity the entity to be saved - * @param array|\ArrayAccess $options The options to use when saving. + * @param \ArrayAccess|array $options The options to use when saving. * @return \Cake\Datasource\EntityInterface|false */ public function save(EntityInterface $entity, $options = []); @@ -157,7 +157,7 @@ public function save(EntityInterface $entity, $options = []); * based on the 'dependent' option used when defining the association. * * @param \Cake\Datasource\EntityInterface $entity The entity to remove. - * @param array|\ArrayAccess $options The options for the delete. + * @param \ArrayAccess|array $options The options for the delete. * @return bool success */ public function delete(EntityInterface $entity, $options = []): bool; @@ -188,7 +188,7 @@ public function newEmptyEntity(): EntityInterface; * is saved. Until the entity is saved, it will be a detached record. * * @param array $data The data to build an entity with. - * @param array $options A list of options for the object hydration. + * @param array $options A list of options for the object hydration. * @return \Cake\Datasource\EntityInterface */ public function newEntity(array $data, array $options = []): EntityInterface; @@ -206,8 +206,8 @@ public function newEntity(array $data, array $options = []): EntityInterface; * The hydrated entities can then be iterated and saved. * * @param array $data The data to build an entity with. - * @param array $options A list of options for the objects hydration. - * @return \Cake\Datasource\EntityInterface[] An array of hydrated records. + * @param array $options A list of options for the objects hydration. + * @return array<\Cake\Datasource\EntityInterface> An array of hydrated records. */ public function newEntities(array $data, array $options = []): array; @@ -225,7 +225,7 @@ public function newEntities(array $data, array $options = []): array; * @param \Cake\Datasource\EntityInterface $entity the entity that will get the * data merged in * @param array $data key value list of fields to be merged into the entity - * @param array $options A list of options for the object hydration. + * @param array $options A list of options for the object hydration. * @return \Cake\Datasource\EntityInterface */ public function patchEntity(EntityInterface $entity, array $data, array $options = []): EntityInterface; @@ -242,11 +242,11 @@ public function patchEntity(EntityInterface $entity, array $data, array $options * $article = $this->Articles->patchEntities($articles, $this->request->getData()); * ``` * - * @param \Cake\Datasource\EntityInterface[]|\Traversable $entities the entities that will get the + * @param \Traversable|array<\Cake\Datasource\EntityInterface> $entities the entities that will get the * data merged in * @param array $data list of arrays to be merged into the entities - * @param array $options A list of options for the objects hydration. - * @return \Cake\Datasource\EntityInterface[] + * @param array $options A list of options for the objects hydration. + * @return array<\Cake\Datasource\EntityInterface> */ public function patchEntities(iterable $entities, array $data, array $options = []): array; } diff --git a/app/vendor/cakephp/cakephp/src/Datasource/RuleInvoker.php b/app/vendor/cakephp/cakephp/src/Datasource/RuleInvoker.php index 3bde1a00..3f9fe54a 100644 --- a/app/vendor/cakephp/cakephp/src/Datasource/RuleInvoker.php +++ b/app/vendor/cakephp/cakephp/src/Datasource/RuleInvoker.php @@ -19,7 +19,7 @@ /** * Contains logic for invoking an application rule. * - * Combined with Cake\Datasource\RuleChecker as an implementation + * Combined with {@link \Cake\Datasource\RulesChecker} as an implementation * detail to de-duplicate rule decoration and provide cleaner separation * of duties. * @@ -61,8 +61,8 @@ class RuleInvoker * rule $scope. * * @param callable $rule The rule to be invoked. - * @param ?string $name The name of the rule. Used in error messsages. - * @param array $options The options for the rule. See above. + * @param ?string $name The name of the rule. Used in error messages. + * @param array $options The options for the rule. See above. */ public function __construct(callable $rule, ?string $name, array $options = []) { @@ -76,7 +76,7 @@ public function __construct(callable $rule, ?string $name, array $options = []) * * Old options will be merged with the new ones. * - * @param array $options The options to set. + * @param array $options The options to set. * @return $this */ public function setOptions(array $options) @@ -109,7 +109,7 @@ public function setName(?string $name) * @param \Cake\Datasource\EntityInterface $entity The entity the rule * should apply to. * @param array $scope The rule's scope/options. - * @return bool Whether or not the rule passed. + * @return bool Whether the rule passed. */ public function __invoke(EntityInterface $entity, array $scope): bool { @@ -119,10 +119,7 @@ public function __invoke(EntityInterface $entity, array $scope): bool return $pass === true; } - $message = 'invalid'; - if (isset($this->options['message'])) { - $message = $this->options['message']; - } + $message = $this->options['message'] ?? 'invalid'; if (is_string($pass)) { $message = $pass; } @@ -139,6 +136,7 @@ public function __invoke(EntityInterface $entity, array $scope): bool $entity->setInvalidField($errorField, $invalidValue); } + /** @phpstan-ignore-next-line */ return $pass === true; } } diff --git a/app/vendor/cakephp/cakephp/src/Datasource/RulesAwareTrait.php b/app/vendor/cakephp/cakephp/src/Datasource/RulesAwareTrait.php index 0e70f375..5c016146 100644 --- a/app/vendor/cakephp/cakephp/src/Datasource/RulesAwareTrait.php +++ b/app/vendor/cakephp/cakephp/src/Datasource/RulesAwareTrait.php @@ -39,7 +39,7 @@ trait RulesAwareTrait protected $_rulesChecker; /** - * Returns whether or not the passed entity complies with all the rules stored in + * Returns whether the passed entity complies with all the rules stored in * the rules checker. * * @param \Cake\Datasource\EntityInterface $entity The entity to check for validity. diff --git a/app/vendor/cakephp/cakephp/src/Datasource/RulesChecker.php b/app/vendor/cakephp/cakephp/src/Datasource/RulesChecker.php index 2d7e7622..1bf5c9c3 100644 --- a/app/vendor/cakephp/cakephp/src/Datasource/RulesChecker.php +++ b/app/vendor/cakephp/cakephp/src/Datasource/RulesChecker.php @@ -29,8 +29,8 @@ * * ### Adding rules * - * Rules must be callable objects that return true/false depending on whether or - * not the rule has been satisfied. You can use RulesChecker::add(), RulesChecker::addCreate(), + * Rules must be callable objects that return true/false depending on whether + * the rule has been satisfied. You can use RulesChecker::add(), RulesChecker::addCreate(), * RulesChecker::addUpdate() and RulesChecker::addDelete to add rules to a checker. * * ### Running checks @@ -65,28 +65,28 @@ class RulesChecker /** * The list of rules to be checked on both create and update operations * - * @var \Cake\Datasource\RuleInvoker[] + * @var array<\Cake\Datasource\RuleInvoker> */ protected $_rules = []; /** * The list of rules to check during create operations * - * @var \Cake\Datasource\RuleInvoker[] + * @var array<\Cake\Datasource\RuleInvoker> */ protected $_createRules = []; /** * The list of rules to check during update operations * - * @var \Cake\Datasource\RuleInvoker[] + * @var array<\Cake\Datasource\RuleInvoker> */ protected $_updateRules = []; /** * The list of rules to check during delete operations * - * @var \Cake\Datasource\RuleInvoker[] + * @var array<\Cake\Datasource\RuleInvoker> */ protected $_deleteRules = []; @@ -98,7 +98,7 @@ class RulesChecker protected $_options = []; /** - * Whether or not to use I18n functions for translating default error messages + * Whether to use I18n functions for translating default error messages * * @var bool */ @@ -107,7 +107,7 @@ class RulesChecker /** * Constructor. Takes the options to be passed to all rules. * - * @param array $options The options to pass to every rule + * @param array $options The options to pass to every rule */ public function __construct(array $options = []) { @@ -129,8 +129,8 @@ public function __construct(array $options = []) * * @param callable $rule A callable function or object that will return whether * the entity is valid or not. - * @param string|array|null $name The alias for a rule, or an array of options. - * @param array $options List of extra options to pass to the rule callable as + * @param array|string|null $name The alias for a rule, or an array of options. + * @param array $options List of extra options to pass to the rule callable as * second argument. * @return $this */ @@ -154,8 +154,8 @@ public function add(callable $rule, $name = null, array $options = []) * * @param callable $rule A callable function or object that will return whether * the entity is valid or not. - * @param string|array|null $name The alias for a rule or an array of options. - * @param array $options List of extra options to pass to the rule callable as + * @param array|string|null $name The alias for a rule or an array of options. + * @param array $options List of extra options to pass to the rule callable as * second argument. * @return $this */ @@ -179,8 +179,8 @@ public function addCreate(callable $rule, $name = null, array $options = []) * * @param callable $rule A callable function or object that will return whether * the entity is valid or not. - * @param string|array|null $name The alias for a rule, or an array of options. - * @param array $options List of extra options to pass to the rule callable as + * @param array|string|null $name The alias for a rule, or an array of options. + * @param array $options List of extra options to pass to the rule callable as * second argument. * @return $this */ @@ -204,8 +204,8 @@ public function addUpdate(callable $rule, $name = null, array $options = []) * * @param callable $rule A callable function or object that will return whether * the entity is valid or not. - * @param string|array|null $name The alias for a rule, or an array of options. - * @param array $options List of extra options to pass to the rule callable as + * @param array|string|null $name The alias for a rule, or an array of options. + * @param array $options List of extra options to pass to the rule callable as * second argument. * @return $this */ @@ -223,7 +223,7 @@ public function addDelete(callable $rule, $name = null, array $options = []) * * @param \Cake\Datasource\EntityInterface $entity The entity to check for validity. * @param string $mode Either 'create, 'update' or 'delete'. - * @param array $options Extra options to pass to checker functions. + * @param array $options Extra options to pass to checker functions. * @return bool * @throws \InvalidArgumentException if an invalid mode is passed. */ @@ -249,7 +249,7 @@ public function check(EntityInterface $entity, string $mode, array $options = [] * of them pass. The rules selected will be only those specified to be run on 'create' * * @param \Cake\Datasource\EntityInterface $entity The entity to check for validity. - * @param array $options Extra options to pass to checker functions. + * @param array $options Extra options to pass to checker functions. * @return bool */ public function checkCreate(EntityInterface $entity, array $options = []): bool @@ -262,7 +262,7 @@ public function checkCreate(EntityInterface $entity, array $options = []): bool * of them pass. The rules selected will be only those specified to be run on 'update' * * @param \Cake\Datasource\EntityInterface $entity The entity to check for validity. - * @param array $options Extra options to pass to checker functions. + * @param array $options Extra options to pass to checker functions. * @return bool */ public function checkUpdate(EntityInterface $entity, array $options = []): bool @@ -275,7 +275,7 @@ public function checkUpdate(EntityInterface $entity, array $options = []): bool * of them pass. The rules selected will be only those specified to be run on 'delete' * * @param \Cake\Datasource\EntityInterface $entity The entity to check for validity. - * @param array $options Extra options to pass to checker functions. + * @param array $options Extra options to pass to checker functions. * @return bool */ public function checkDelete(EntityInterface $entity, array $options = []): bool @@ -288,8 +288,8 @@ public function checkDelete(EntityInterface $entity, array $options = []): bool * iterates an array containing the rules to be checked and checks them all. * * @param \Cake\Datasource\EntityInterface $entity The entity to check for validity. - * @param array $options Extra options to pass to checker functions. - * @param \Cake\Datasource\RuleInvoker[] $rules The list of rules that must be checked. + * @param array $options Extra options to pass to checker functions. + * @param array<\Cake\Datasource\RuleInvoker> $rules The list of rules that must be checked. * @return bool */ protected function _checkRules(EntityInterface $entity, array $options = [], array $rules = []): bool @@ -307,9 +307,9 @@ protected function _checkRules(EntityInterface $entity, array $options = [], arr * Utility method for decorating any callable so that if it returns false, the correct * property in the entity is marked as invalid. * - * @param callable $rule The rule to decorate - * @param string|array|null $name The alias for a rule or an array of options - * @param array $options The options containing the error message and field. + * @param callable|\Cake\Datasource\RuleInvoker $rule The rule to decorate + * @param array|string|null $name The alias for a rule or an array of options + * @param array $options The options containing the error message and field. * @return \Cake\Datasource\RuleInvoker */ protected function _addError(callable $rule, $name = null, array $options = []): RuleInvoker diff --git a/app/vendor/cakephp/cakephp/src/Datasource/SchemaInterface.php b/app/vendor/cakephp/cakephp/src/Datasource/SchemaInterface.php index fdcb7a8e..eef98d1b 100644 --- a/app/vendor/cakephp/cakephp/src/Datasource/SchemaInterface.php +++ b/app/vendor/cakephp/cakephp/src/Datasource/SchemaInterface.php @@ -41,10 +41,10 @@ public function name(): string; * - `precision` The number of decimal places to store * for float and decimal types. * - `default` The default value of the column. - * - `null` Whether or not the column can hold nulls. - * - `fixed` Whether or not the column is a fixed length column. + * - `null` Whether the column can hold nulls. + * - `fixed` Whether the column is a fixed length column. * This is only present/valid with string columns. - * - `unsigned` Whether or not the column is an unsigned column. + * - `unsigned` Whether the column is an unsigned column. * This is only present/valid for integer, decimal, float columns. * * In addition to the above keys, the following keys are @@ -53,7 +53,7 @@ public function name(): string; * - `comment` The comment for the column. * * @param string $name The name of the column - * @param string|array $attrs The attributes for the column or the type name. + * @param array|string $attrs The attributes for the column or the type name. * @return $this */ public function addColumn(string $name, $attrs); @@ -62,7 +62,7 @@ public function addColumn(string $name, $attrs); * Get column data in the table. * * @param string $name The column name. - * @return array|null Column data or null. + * @return array|null Column data or null. */ public function getColumn(string $name): ?array; @@ -87,7 +87,7 @@ public function removeColumn(string $name); /** * Get the column names in the table. * - * @return string[] + * @return array */ public function columns(): array; @@ -119,12 +119,12 @@ public function setColumnType(string $name, string $type); public function baseColumnType(string $column): ?string; /** - * Check whether or not a field is nullable + * Check whether a field is nullable * * Missing columns are nullable. * * @param string $name The column to get the type of. - * @return bool Whether or not the field is nullable. + * @return bool Whether the field is nullable. */ public function isNullable(string $name): bool; @@ -132,14 +132,14 @@ public function isNullable(string $name): bool; * Returns an array where the keys are the column names in the schema * and the values the database type they have. * - * @return array + * @return array */ public function typeMap(): array; /** * Get a hash of columns and their default values. * - * @return array + * @return array */ public function defaultValues(): array; @@ -149,7 +149,7 @@ public function defaultValues(): array; * Table options allow you to set platform specific table level options. * For example the engine type in MySQL. * - * @param array $options The options to set, or null to read options. + * @param array $options The options to set, or null to read options. * @return $this */ public function setOptions(array $options); @@ -160,7 +160,7 @@ public function setOptions(array $options); * Table options allow you to set platform specific table level options. * For example the engine type in MySQL. * - * @return array An array of options. + * @return array An array of options. */ public function getOptions(): array; } diff --git a/app/vendor/cakephp/cakephp/src/Datasource/composer.json b/app/vendor/cakephp/cakephp/src/Datasource/composer.json index ffd623c0..ca90fc1c 100644 --- a/app/vendor/cakephp/cakephp/src/Datasource/composer.json +++ b/app/vendor/cakephp/cakephp/src/Datasource/composer.json @@ -26,8 +26,8 @@ "require": { "php": ">=7.2.0", "cakephp/core": "^4.0", - "psr/log": "^1.1", - "psr/simple-cache": "^1.0" + "psr/log": "^1.0 || ^2.0", + "psr/simple-cache": "^1.0 || ^2.0" }, "suggest": { "cakephp/utility": "If you decide to use EntityTrait.", diff --git a/app/vendor/cakephp/cakephp/src/Error/BaseErrorHandler.php b/app/vendor/cakephp/cakephp/src/Error/BaseErrorHandler.php index 6f55b294..c4b3f1d1 100644 --- a/app/vendor/cakephp/cakephp/src/Error/BaseErrorHandler.php +++ b/app/vendor/cakephp/cakephp/src/Error/BaseErrorHandler.php @@ -37,7 +37,7 @@ abstract class BaseErrorHandler /** * Options to use for the Error handling. * - * @var array + * @var array */ protected $_defaultConfig = [ 'log' => true, @@ -65,7 +65,7 @@ abstract class BaseErrorHandler * desired for the runtime they operate in. * * @param array $error An array of error data. - * @param bool $debug Whether or not the app is in debug mode. + * @param bool $debug Whether the app is in debug mode. * @return void */ abstract protected function _displayError(array $error, bool $debug): void; @@ -88,10 +88,7 @@ abstract protected function _displayException(Throwable $exception): void; */ public function register(): void { - $level = -1; - if (isset($this->_config['errorLevel'])) { - $level = $this->_config['errorLevel']; - } + $level = $this->_config['errorLevel'] ?? -1; error_reporting($level); set_error_handler([$this, 'handleError'], $level); set_exception_handler([$this, 'handleException']); @@ -138,7 +135,7 @@ public function register(): void * @param string $description Error description * @param string|null $file File on which error occurred * @param int|null $line Line that triggered the error - * @param array|null $context Context + * @param array|null $context Context * @return bool True if error was handled */ public function handleError( @@ -272,7 +269,7 @@ public function handleFatalError(int $code, string $description, string $file, i public function increaseMemoryLimit(int $additionalKb): void { $limit = ini_get('memory_limit'); - if (!strlen($limit) || $limit === '-1') { + if ($limit === false || $limit === '' || $limit === '-1') { return; } $limit = trim($limit); @@ -295,7 +292,7 @@ public function increaseMemoryLimit(int $additionalKb): void /** * Log an error. * - * @param int|string $level The level name of the log. + * @param string|int $level The level name of the log. * @param array $data Array of error data. * @return bool */ @@ -325,7 +322,7 @@ protected function _logError($level, array $data): bool * Log an error for the exception if applicable. * * @param \Throwable $exception The exception to log a message for. - * @param \Psr\Http\Message\ServerRequestInterface $request The current request. + * @param \Psr\Http\Message\ServerRequestInterface|null $request The current request. * @return bool */ public function logException(Throwable $exception, ?ServerRequestInterface $request = null): bool diff --git a/app/vendor/cakephp/cakephp/src/Error/ConsoleErrorHandler.php b/app/vendor/cakephp/cakephp/src/Error/ConsoleErrorHandler.php index 6eff9ec5..fa12c763 100644 --- a/app/vendor/cakephp/cakephp/src/Error/ConsoleErrorHandler.php +++ b/app/vendor/cakephp/cakephp/src/Error/ConsoleErrorHandler.php @@ -37,7 +37,7 @@ class ConsoleErrorHandler extends BaseErrorHandler /** * Constructor * - * @param array $config Config options for the error handler. + * @param array $config Config options for the error handler. */ public function __construct(array $config = []) { @@ -100,7 +100,7 @@ protected function _displayException(Throwable $exception): void * Template method of BaseErrorHandler. * * @param array $error An array of error data. - * @param bool $debug Whether or not the app is in debug mode. + * @param bool $debug Whether the app is in debug mode. * @return void */ protected function _displayError(array $error, bool $debug): void diff --git a/app/vendor/cakephp/cakephp/src/Error/Debug/ArrayNode.php b/app/vendor/cakephp/cakephp/src/Error/Debug/ArrayNode.php index 115a40f1..ccbb7274 100644 --- a/app/vendor/cakephp/cakephp/src/Error/Debug/ArrayNode.php +++ b/app/vendor/cakephp/cakephp/src/Error/Debug/ArrayNode.php @@ -22,14 +22,14 @@ class ArrayNode implements NodeInterface { /** - * @var \Cake\Error\Debug\ArrayItemNode[] + * @var array<\Cake\Error\Debug\ArrayItemNode> */ private $items; /** * Constructor * - * @param \Cake\Error\Debug\ArrayItemNode[] $items The items for the array + * @param array<\Cake\Error\Debug\ArrayItemNode> $items The items for the array */ public function __construct(array $items = []) { @@ -53,7 +53,7 @@ public function add(ArrayItemNode $node): void /** * Get the contained items * - * @return \Cake\Error\Debug\ArrayItemNode[] + * @return array<\Cake\Error\Debug\ArrayItemNode> */ public function getValue(): array { @@ -63,7 +63,7 @@ public function getValue(): array /** * Get Item nodes * - * @return \Cake\Error\Debug\ArrayItemNode[] + * @return array<\Cake\Error\Debug\ArrayItemNode> */ public function getChildren(): array { diff --git a/app/vendor/cakephp/cakephp/src/Error/Debug/ClassNode.php b/app/vendor/cakephp/cakephp/src/Error/Debug/ClassNode.php index d97ea328..62fa5852 100644 --- a/app/vendor/cakephp/cakephp/src/Error/Debug/ClassNode.php +++ b/app/vendor/cakephp/cakephp/src/Error/Debug/ClassNode.php @@ -32,7 +32,7 @@ class ClassNode implements NodeInterface private $id; /** - * @var \Cake\Error\Debug\PropertyNode[] + * @var array<\Cake\Error\Debug\PropertyNode> */ private $properties = []; @@ -82,7 +82,7 @@ public function getId(): int /** * Get property nodes * - * @return \Cake\Error\Debug\PropertyNode[] + * @return array<\Cake\Error\Debug\PropertyNode> */ public function getChildren(): array { diff --git a/app/vendor/cakephp/cakephp/src/Error/Debug/ConsoleFormatter.php b/app/vendor/cakephp/cakephp/src/Error/Debug/ConsoleFormatter.php index 5f1c6bd8..b45df229 100644 --- a/app/vendor/cakephp/cakephp/src/Error/Debug/ConsoleFormatter.php +++ b/app/vendor/cakephp/cakephp/src/Error/Debug/ConsoleFormatter.php @@ -28,7 +28,7 @@ class ConsoleFormatter implements FormatterInterface /** * text colors used in colored output. * - * @var array + * @var array */ protected $styles = [ // bold yellow diff --git a/app/vendor/cakephp/cakephp/src/Error/Debug/DebugContext.php b/app/vendor/cakephp/cakephp/src/Error/Debug/DebugContext.php index 7eb21bf5..c240e3fe 100644 --- a/app/vendor/cakephp/cakephp/src/Error/Debug/DebugContext.php +++ b/app/vendor/cakephp/cakephp/src/Error/Debug/DebugContext.php @@ -31,7 +31,7 @@ class DebugContext /** * @var int */ - private $maxDepth = 0; + private $maxDepth; /** * @var int diff --git a/app/vendor/cakephp/cakephp/src/Error/Debug/NodeInterface.php b/app/vendor/cakephp/cakephp/src/Error/Debug/NodeInterface.php index 82e25c48..6a17c795 100644 --- a/app/vendor/cakephp/cakephp/src/Error/Debug/NodeInterface.php +++ b/app/vendor/cakephp/cakephp/src/Error/Debug/NodeInterface.php @@ -26,7 +26,7 @@ interface NodeInterface /** * Get the child nodes of this node. * - * @return \Cake\Error\Debug\NodeInterface[] + * @return array<\Cake\Error\Debug\NodeInterface> */ public function getChildren(): array; diff --git a/app/vendor/cakephp/cakephp/src/Error/Debug/PropertyNode.php b/app/vendor/cakephp/cakephp/src/Error/Debug/PropertyNode.php index ebe0338c..568bc00a 100644 --- a/app/vendor/cakephp/cakephp/src/Error/Debug/PropertyNode.php +++ b/app/vendor/cakephp/cakephp/src/Error/Debug/PropertyNode.php @@ -40,7 +40,7 @@ class PropertyNode implements NodeInterface * Constructor * * @param string $name The property name - * @param string $visibility The visibility of the property. + * @param string|null $visibility The visibility of the property. * @param \Cake\Error\Debug\NodeInterface $value The property value node. */ public function __construct(string $name, ?string $visibility, NodeInterface $value) diff --git a/app/vendor/cakephp/cakephp/src/Error/Debug/ScalarNode.php b/app/vendor/cakephp/cakephp/src/Error/Debug/ScalarNode.php index cb4098d8..e5c5efe4 100644 --- a/app/vendor/cakephp/cakephp/src/Error/Debug/ScalarNode.php +++ b/app/vendor/cakephp/cakephp/src/Error/Debug/ScalarNode.php @@ -27,7 +27,7 @@ class ScalarNode implements NodeInterface private $type; /** - * @var string|int|float|bool|null + * @var string|float|int|bool|null */ private $value; @@ -35,7 +35,7 @@ class ScalarNode implements NodeInterface * Constructor * * @param string $type The type of scalar value. - * @param string|int|float|bool|null $value The wrapped value. + * @param string|float|int|bool|null $value The wrapped value. */ public function __construct(string $type, $value) { @@ -56,7 +56,7 @@ public function getType(): string /** * Get the value * - * @return string|int|float|bool|null + * @return string|float|int|bool|null */ public function getValue() { diff --git a/app/vendor/cakephp/cakephp/src/Error/Debugger.php b/app/vendor/cakephp/cakephp/src/Error/Debugger.php index e4bac37e..ad4395da 100644 --- a/app/vendor/cakephp/cakephp/src/Error/Debugger.php +++ b/app/vendor/cakephp/cakephp/src/Error/Debugger.php @@ -58,7 +58,7 @@ class Debugger /** * Default configuration * - * @var array + * @var array */ protected $_defaultConfig = [ 'outputMask' => [], @@ -77,7 +77,7 @@ class Debugger * Templates used when generating trace or error strings. Can be global or indexed by the format * value used in $_outputFormat. * - * @var array + * @var array> */ protected $_templates = [ 'log' => [ @@ -113,7 +113,7 @@ class Debugger /** * A map of editors to their link templates. * - * @var array + * @var array */ protected $editors = [ 'atom' => 'atom://core/open/file?filename={file}&line={line}', @@ -214,7 +214,7 @@ public static function getInstance(?string $class = null) /** * Read or write configuration options for the Debugger instance. * - * @param string|array|null $key The key to get/set, or a complete array of configs. + * @param array|string|null $key The key to get/set, or a complete array of configs. * @param mixed|null $value The value to set. * @param bool $merge Whether to recursively merge or overwrite existing config, defaults to true. * @return mixed Config value being read, or the object itself on write operations. @@ -236,7 +236,7 @@ public static function configInstance($key = null, $value = null, bool $merge = /** * Reads the current output masking. * - * @return array + * @return array */ public static function outputMask(): array { @@ -250,7 +250,7 @@ public static function outputMask(): array * * Debugger::setOutputMask(['password' => '[*************]'); * - * @param array $value An array where keys are replaced by their values in output. + * @param array $value An array where keys are replaced by their values in output. * @param bool $merge Whether to recursively merge or overwrite existing config, defaults to true. * @return void */ @@ -267,7 +267,7 @@ public static function setOutputMask(array $value, bool $merge = true): void * The file and line. * * @param string $name The name of the editor. - * @param string|\Closure $template The string template or closure + * @param \Closure|string $template The string template or closure * @return void */ public static function addEditor(string $name, $template): void @@ -335,10 +335,10 @@ public static function dump($var, int $maxDepth = 3): void /** * Creates an entry in the log file. The log entry will contain a stack trace from where it was called. - * as well as export the variable using exportVar. By default the log is written to the debug log. + * as well as export the variable using exportVar. By default, the log is written to the debug log. * * @param mixed $var Variable or content to log. - * @param int|string $level Type of log to use. Defaults to 'debug'. + * @param string|int $level Type of log to use. Defaults to 'debug'. * @param int $maxDepth The depth to output to. Defaults to 3. * @return void */ @@ -348,7 +348,10 @@ public static function log($var, $level = 'debug', int $maxDepth = 3): void $source = static::trace(['start' => 1]); $source .= "\n"; - Log::write($level, "\n" . $source . static::exportVar($var, $maxDepth)); + Log::write( + $level, + "\n" . $source . static::exportVarAsPlainText($var, $maxDepth) + ); } /** @@ -363,8 +366,8 @@ public static function log($var, $level = 'debug', int $maxDepth = 3): void * will be displayed. * - `start` - The stack frame to start generating a trace from. Defaults to 0 * - * @param array $options Format for outputting stack trace. - * @return string|array Formatted stack trace. + * @param array $options Format for outputting stack trace. + * @return array|string Formatted stack trace. * @link https://book.cakephp.org/4/en/development/debugging.html#generating-stack-traces */ public static function trace(array $options = []) @@ -384,9 +387,9 @@ public static function trace(array $options = []) * will be displayed. * - `start` - The stack frame to start generating a trace from. Defaults to 0 * - * @param array|\Throwable $backtrace Trace as array or an exception object. - * @param array $options Format for outputting stack trace. - * @return string|array Formatted stack trace. + * @param \Throwable|array $backtrace Trace as array or an exception object. + * @param array $options Format for outputting stack trace. + * @return array|string Formatted stack trace. * @link https://book.cakephp.org/4/en/development/debugging.html#generating-stack-traces */ public static function formatTrace($backtrace, array $options = []) @@ -496,14 +499,14 @@ public static function trimPath(string $path): string * ``` * * The above would return an array of 8 items. The 4th item would be the provided line, - * and would be wrapped in ``. All of the lines + * and would be wrapped in ``. All the lines * are processed with highlight_string() as well, so they have basic PHP syntax highlighting * applied. * * @param string $file Absolute path to a PHP file. * @param int $line Line number to highlight. * @param int $context Number of lines of context to extract above and below $line. - * @return array Set of lines highlighted + * @return array Set of lines highlighted * @see https://secure.php.net/highlight_string * @link https://book.cakephp.org/4/en/development/debugging.html#getting-an-excerpt-from-a-file */ @@ -627,6 +630,20 @@ public static function exportVar($var, int $maxDepth = 3): string return static::getInstance()->getExportFormatter()->dump($node); } + /** + * Converts a variable to a plain text string. + * + * @param mixed $var Variable to convert. + * @param int $maxDepth The depth to output to. Defaults to 3. + * @return string Variable as a string + */ + public static function exportVarAsPlainText($var, int $maxDepth = 3): string + { + return (new TextFormatter())->dump( + static::export($var, new DebugContext($maxDepth)) + ); + } + /** * Convert the variable to the internal node tree. * diff --git a/app/vendor/cakephp/cakephp/src/Error/ErrorHandler.php b/app/vendor/cakephp/cakephp/src/Error/ErrorHandler.php index b78de70b..540f02a8 100644 --- a/app/vendor/cakephp/cakephp/src/Error/ErrorHandler.php +++ b/app/vendor/cakephp/cakephp/src/Error/ErrorHandler.php @@ -93,7 +93,7 @@ class ErrorHandler extends BaseErrorHandler /** * Constructor * - * @param array $config The options for error handling. + * @param array $config The options for error handling. */ public function __construct(array $config = []) { @@ -110,7 +110,7 @@ public function __construct(array $config = []) * Template method of BaseErrorHandler. * * @param array $error An array of error data. - * @param bool $debug Whether or not the app is in debug mode. + * @param bool $debug Whether the app is in debug mode. * @return void */ protected function _displayError(array $error, bool $debug): void @@ -199,7 +199,7 @@ protected function _logInternalError(Throwable $exception): void /** * Method that can be easily stubbed in testing. * - * @param string|\Cake\Http\Response $response Either the message or response object. + * @param \Cake\Http\Response|string $response Either the message or response object. * @return void */ protected function _sendResponse($response): void diff --git a/app/vendor/cakephp/cakephp/src/Error/ErrorLogger.php b/app/vendor/cakephp/cakephp/src/Error/ErrorLogger.php index 21285bd5..91b81db0 100644 --- a/app/vendor/cakephp/cakephp/src/Error/ErrorLogger.php +++ b/app/vendor/cakephp/cakephp/src/Error/ErrorLogger.php @@ -37,7 +37,7 @@ class ErrorLogger implements ErrorLoggerInterface * extend one of the listed exceptions will also not be logged. * - `trace` Should error logs include stack traces? * - * @var array + * @var array */ protected $_defaultConfig = [ 'skipLog' => [], @@ -47,7 +47,7 @@ class ErrorLogger implements ErrorLoggerInterface /** * Constructor * - * @param array $config Config array. + * @param array $config Config array. */ public function __construct(array $config = []) { diff --git a/app/vendor/cakephp/cakephp/src/Error/ExceptionRenderer.php b/app/vendor/cakephp/cakephp/src/Error/ExceptionRenderer.php index 6c9f647b..9c0e6fad 100644 --- a/app/vendor/cakephp/cakephp/src/Error/ExceptionRenderer.php +++ b/app/vendor/cakephp/cakephp/src/Error/ExceptionRenderer.php @@ -18,6 +18,7 @@ use Cake\Controller\Controller; use Cake\Controller\ControllerFactory; +use Cake\Controller\Exception\InvalidParameterException; use Cake\Controller\Exception\MissingActionException; use Cake\Core\App; use Cake\Core\Configure; @@ -75,7 +76,7 @@ class ExceptionRenderer implements ExceptionRendererInterface protected $controller; /** - * Template to render for Cake\Core\Exception\CakeException + * Template to render for {@link \Cake\Core\Exception\CakeException} * * @var string */ @@ -102,11 +103,12 @@ class ExceptionRenderer implements ExceptionRendererInterface * This can be customized for users that don't want specific exceptions to throw 404 errors * or want their application exceptions to be automatically converted. * - * @var array + * @var array * @psalm-var array, int> */ protected $exceptionHttpCodes = [ // Controller exceptions + InvalidParameterException::class => 404, MissingActionException::class => 404, // Datasource exceptions PageOutOfBoundsException::class => 404, @@ -121,7 +123,7 @@ class ExceptionRenderer implements ExceptionRendererInterface * Creates the controller to perform rendering on the error response. * * @param \Throwable $exception Exception. - * @param \Cake\Http\ServerRequest $request The request if this is set it will be used + * @param \Cake\Http\ServerRequest|null $request The request if this is set it will be used * instead of creating a new one. */ public function __construct(Throwable $exception, ?ServerRequest $request = null) @@ -394,10 +396,7 @@ protected function _outputMessage(string $template): Response $attributes = $e->getAttributes(); if ( $e instanceof MissingLayoutException || - ( - isset($attributes['file']) && - strpos($attributes['file'], 'error500') !== false - ) + strpos($attributes['file'], 'error500') !== false ) { return $this->_outputMessageSafe('error500'); } @@ -410,8 +409,12 @@ protected function _outputMessage(string $template): Response } return $this->_outputMessageSafe('error500'); - } catch (Throwable $e) { - return $this->_outputMessageSafe('error500'); + } catch (Throwable $outer) { + try { + return $this->_outputMessageSafe('error500'); + } catch (Throwable $inner) { + throw $outer; + } } } @@ -457,7 +460,7 @@ protected function _shutdown(): Response * Returns an array that can be used to describe the internal state of this * object. * - * @return array + * @return array */ public function __debugInfo(): array { diff --git a/app/vendor/cakephp/cakephp/src/Error/Middleware/ErrorHandlerMiddleware.php b/app/vendor/cakephp/cakephp/src/Error/Middleware/ErrorHandlerMiddleware.php index 8f2ea796..56593544 100644 --- a/app/vendor/cakephp/cakephp/src/Error/Middleware/ErrorHandlerMiddleware.php +++ b/app/vendor/cakephp/cakephp/src/Error/Middleware/ErrorHandlerMiddleware.php @@ -59,7 +59,7 @@ class ErrorHandlerMiddleware implements MiddlewareInterface * which returns a \Cake\Error\ExceptionRendererInterface instance. * Defaults to \Cake\Error\ExceptionRenderer * - * @var array + * @var array */ protected $_defaultConfig = [ 'skipLog' => [], diff --git a/app/vendor/cakephp/cakephp/src/Event/Decorator/AbstractDecorator.php b/app/vendor/cakephp/cakephp/src/Event/Decorator/AbstractDecorator.php index 5061d607..0e5d59d3 100644 --- a/app/vendor/cakephp/cakephp/src/Event/Decorator/AbstractDecorator.php +++ b/app/vendor/cakephp/cakephp/src/Event/Decorator/AbstractDecorator.php @@ -39,7 +39,7 @@ abstract class AbstractDecorator * Constructor. * * @param callable $callable Callable. - * @param array $options Decorator options. + * @param array $options Decorator options. */ public function __construct(callable $callable, array $options = []) { diff --git a/app/vendor/cakephp/cakephp/src/Event/Event.php b/app/vendor/cakephp/cakephp/src/Event/Event.php index 75084ca3..12f7be34 100644 --- a/app/vendor/cakephp/cakephp/src/Event/Event.php +++ b/app/vendor/cakephp/cakephp/src/Event/Event.php @@ -76,7 +76,7 @@ class Event implements EventInterface * @param string $name Name of the event * @param object|null $subject the object that this event applies to * (usually the object that is generating the event). - * @param array|\ArrayAccess|null $data any value you wish to be transported + * @param \ArrayAccess|array|null $data any value you wish to be transported * with this event to it can be read by listeners. * @psalm-param TSubject|null $subject */ @@ -163,7 +163,7 @@ public function setResult($value = null) * Access the event data/payload. * * @param string|null $key The data payload element to return, or null to return all data. - * @return array|mixed|null The data payload if $key is null, or the data value for the given $key. + * @return mixed|array|null The data payload if $key is null, or the data value for the given $key. * If the $key does not exist a null value is returned. */ public function getData(?string $key = null) diff --git a/app/vendor/cakephp/cakephp/src/Event/EventDispatcherInterface.php b/app/vendor/cakephp/cakephp/src/Event/EventDispatcherInterface.php index 3bd812d0..7ab36269 100644 --- a/app/vendor/cakephp/cakephp/src/Event/EventDispatcherInterface.php +++ b/app/vendor/cakephp/cakephp/src/Event/EventDispatcherInterface.php @@ -22,7 +22,7 @@ * Objects with this interface can trigger events, and have * an event manager retrieved from them. * - * The Cake\Event\EventDispatcherTrait lets you easily implement + * The {@link \Cake\Event\EventDispatcherTrait} lets you easily implement * this interface. */ interface EventDispatcherInterface diff --git a/app/vendor/cakephp/cakephp/src/Event/EventInterface.php b/app/vendor/cakephp/cakephp/src/Event/EventInterface.php index e67aceed..f11cb6d4 100644 --- a/app/vendor/cakephp/cakephp/src/Event/EventInterface.php +++ b/app/vendor/cakephp/cakephp/src/Event/EventInterface.php @@ -70,7 +70,7 @@ public function setResult($value = null); * Accesses the event data/payload. * * @param string|null $key The data payload element to return, or null to return all data. - * @return array|mixed|null The data payload if $key is null, or the data value for the given $key. + * @return mixed|array|null The data payload if $key is null, or the data value for the given $key. * If the $key does not exist a null value is returned. */ public function getData(?string $key = null); diff --git a/app/vendor/cakephp/cakephp/src/Event/EventList.php b/app/vendor/cakephp/cakephp/src/Event/EventList.php index 1425f8ba..e8cc40c9 100644 --- a/app/vendor/cakephp/cakephp/src/Event/EventList.php +++ b/app/vendor/cakephp/cakephp/src/Event/EventList.php @@ -27,7 +27,7 @@ class EventList implements ArrayAccess, Countable /** * Events list * - * @var \Cake\Event\EventInterface[] + * @var array<\Cake\Event\EventInterface> */ protected $_events = []; @@ -71,6 +71,7 @@ public function offsetExists($offset): bool * @param mixed $offset The offset to retrieve. * @return mixed Can return all value types. */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { if ($this->offsetExists($offset)) { diff --git a/app/vendor/cakephp/cakephp/src/Event/EventListenerInterface.php b/app/vendor/cakephp/cakephp/src/Event/EventListenerInterface.php index 484cddf9..8439f6f3 100644 --- a/app/vendor/cakephp/cakephp/src/Event/EventListenerInterface.php +++ b/app/vendor/cakephp/cakephp/src/Event/EventListenerInterface.php @@ -17,7 +17,7 @@ namespace Cake\Event; /** - * Objects implementing this interface should declare the `implementedEvents` function + * Objects implementing this interface should declare the `implementedEvents()` method * to notify the event manager what methods should be called when an event is triggered. */ interface EventListenerInterface @@ -39,7 +39,7 @@ interface EventListenerInterface * } * ``` * - * @return array Associative array or event key names pointing to the function + * @return array Associative array or event key names pointing to the function * that should be called in the object when the respective event is fired */ public function implementedEvents(): array; diff --git a/app/vendor/cakephp/cakephp/src/Event/EventManager.php b/app/vendor/cakephp/cakephp/src/Event/EventManager.php index e65ab137..8bea9679 100644 --- a/app/vendor/cakephp/cakephp/src/Event/EventManager.php +++ b/app/vendor/cakephp/cakephp/src/Event/EventManager.php @@ -151,7 +151,7 @@ protected function _attachSubscriber(EventListenerInterface $subscriber): void /** * Auxiliary function to extract and return a PHP callback type out of the callable definition - * from the return value of the `implementedEvents` method on a Cake\Event\EventListenerInterface + * from the return value of the `implementedEvents()` method on a {@link \Cake\Event\EventListenerInterface} * * @param array $function the array taken from a handler definition for an event * @param \Cake\Event\EventListenerInterface $object The handler object @@ -451,7 +451,7 @@ public function unsetEventList() /** * Debug friendly object properties. * - * @return array + * @return array */ public function __debugInfo(): array { diff --git a/app/vendor/cakephp/cakephp/src/Event/EventManagerInterface.php b/app/vendor/cakephp/cakephp/src/Event/EventManagerInterface.php index 80d90a0e..1581f769 100644 --- a/app/vendor/cakephp/cakephp/src/Event/EventManagerInterface.php +++ b/app/vendor/cakephp/cakephp/src/Event/EventManagerInterface.php @@ -43,11 +43,11 @@ interface EventManagerInterface * $eventManager->on('Model.beforeSave', ['priority' => 90], $callable); * ``` * - * @param string|\Cake\Event\EventListenerInterface $eventKey The event unique identifier name + * @param \Cake\Event\EventListenerInterface|string $eventKey The event unique identifier name * with which the callback will be associated. If $eventKey is an instance of - * Cake\Event\EventListenerInterface its events will be bound using the `implementedEvents` methods. + * Cake\Event\EventListenerInterface its events will be bound using the `implementedEvents()` methods. * - * @param array|callable $options Either an array of options or the callable you wish to + * @param callable|array $options Either an array of options or the callable you wish to * bind to $eventKey. If an array of options, the `priority` key can be used to define the order. * Priorities are treated as queues. Lower values are called before higher ones, and multiple attachments * added to the same priority queue will be treated in the order of insertion. @@ -86,7 +86,7 @@ public function on($eventKey, $options = [], ?callable $callable = null); * $manager->off($callback); * ``` * - * @param string|\Cake\Event\EventListenerInterface|callable $eventKey The event unique identifier name + * @param \Cake\Event\EventListenerInterface|callable|string $eventKey The event unique identifier name * with which the callback has been associated, or the $listener you want to remove. * @param \Cake\Event\EventListenerInterface|callable|null $callable The callback you want to detach. * @return $this @@ -96,7 +96,7 @@ public function off($eventKey, $callable = null); /** * Dispatches a new event to all configured listeners * - * @param string|\Cake\Event\EventInterface $event The event key name or instance of EventInterface. + * @param \Cake\Event\EventInterface|string $event The event key name or instance of EventInterface. * @return \Cake\Event\EventInterface * @triggers $event */ diff --git a/app/vendor/cakephp/cakephp/src/Filesystem/File.php b/app/vendor/cakephp/cakephp/src/Filesystem/File.php index b146b71d..708a2583 100644 --- a/app/vendor/cakephp/cakephp/src/Filesystem/File.php +++ b/app/vendor/cakephp/cakephp/src/Filesystem/File.php @@ -45,7 +45,7 @@ class File /** * File info * - * @var array + * @var array * https://book.cakephp.org/4/en/core-libraries/file-folder.html#Cake\Filesystem\File::$info */ public $info = []; @@ -297,22 +297,17 @@ public function delete(): bool * - filesize * - mime * - * @return array File information. + * @return array File information. */ public function info(): array { if (!$this->info) { $this->info = pathinfo($this->path); } - if (!isset($this->info['filename'])) { - $this->info['filename'] = $this->name(); - } - if (!isset($this->info['filesize'])) { - $this->info['filesize'] = $this->size(); - } - if (!isset($this->info['mime'])) { - $this->info['mime'] = $this->mime(); - } + + $this->info['filename'] = $this->info['filename'] ?? $this->name(); + $this->info['filesize'] = $this->info['filesize'] ?? $this->size(); + $this->info['mime'] = $this->info['mime'] ?? $this->mime(); return $this->info; } @@ -327,11 +322,8 @@ public function ext() if (!$this->info) { $this->info(); } - if (isset($this->info['extension'])) { - return $this->info['extension']; - } - return false; + return $this->info['extension'] ?? false; } /** @@ -424,7 +416,7 @@ public function md5($maxsize = 5) /** * Returns the full path of the file. * - * @return string|false Full path to the file, or false on failure + * @return string|null Full path to the file, or null on failure */ public function pwd() { @@ -637,8 +629,8 @@ public function clearStatCache($all = false): void /** * Searches for a given text and replaces the text if found. * - * @param string|array $search Text(s) to search for. - * @param string|array $replace Text(s) to replace with. + * @param array|string $search Text(s) to search for. + * @param array|string $replace Text(s) to replace with. * @return bool Success */ public function replaceText($search, $replace): bool diff --git a/app/vendor/cakephp/cakephp/src/Filesystem/Folder.php b/app/vendor/cakephp/cakephp/src/Filesystem/Folder.php index 83da3d71..e593ccee 100644 --- a/app/vendor/cakephp/cakephp/src/Filesystem/Folder.php +++ b/app/vendor/cakephp/cakephp/src/Filesystem/Folder.php @@ -77,7 +77,7 @@ class Folder public $path; /** - * Sortedness. Whether or not list results + * Sortedness. Whether list results * should be sorted by name. * * @var bool @@ -95,7 +95,7 @@ class Folder /** * Functions array to be called depending on the sort type chosen. * - * @var string[] + * @var array */ protected $_fsorts = [ self::SORT_NAME => 'getPathname', @@ -257,7 +257,7 @@ public function read($sort = self::SORT_NAME, $exceptions = false, bool $fullPat * * @param string $regexpPattern Preg_match pattern (Defaults to: .*) * @param string|bool $sort Whether results should be sorted. - * @return array Files that match given pattern + * @return array Files that match given pattern */ public function find(string $regexpPattern = '.*', $sort = false): array { @@ -349,7 +349,7 @@ public static function isAbsolute(string $path): bool */ public static function isRegisteredStreamWrapper(string $path): bool { - return preg_match('/^[^:\/\/]+?(?=:\/\/)/', $path, $matches) && + return preg_match('/^[^:\/]+?(?=:\/\/)/', $path, $matches) && in_array($matches[0], stream_get_wrappers(), true); } @@ -397,7 +397,7 @@ public static function slashTerm(string $path): string * Returns $path with $element added, with correct slash in-between. * * @param string $path Path - * @param string|array $element Element to add at end of path + * @param array|string $element Element to add at end of path * @return string Combined path */ public static function addPathElement(string $path, $element): string @@ -440,7 +440,7 @@ public function inPath(string $path, bool $reverse = false): bool * @param string $path The path to chmod. * @param int|null $mode Octal value, e.g. 0755. * @param bool $recursive Chmod recursively, set to false to only change the current directory. - * @param string[] $exceptions Array of files, directories to skip. + * @param array $exceptions Array of files, directories to skip. * @return bool Success. */ public function chmod(string $path, ?int $mode = null, bool $recursive = true, array $exceptions = []): bool @@ -646,13 +646,12 @@ public function create(string $pathname, ?int $mode = null): bool if ($this->create($nextPathname, $mode)) { if (!file_exists($pathname)) { $old = umask(0); + umask($old); if (mkdir($pathname, $mode, true)) { - umask($old); $this->_messages[] = sprintf('%s created', $pathname); return true; } - umask($old); $this->_errors[] = sprintf('%s NOT created', $pathname); return false; @@ -783,7 +782,7 @@ public function delete(?string $path = null): bool * - `recursive` Whether to copy recursively or not (default: true - recursive) * * @param string $to The directory to copy to. - * @param array $options Array of options (see above). + * @param array $options Array of options (see above). * @return bool Success. */ public function copy(string $to, array $options = []): bool @@ -884,7 +883,7 @@ public function copy(string $to, array $options = []): bool * - `recursive` Whether to copy recursively or not (default: true - recursive) * * @param string $to The directory to move to. - * @param array $options Array of options (see above). + * @param array $options Array of options (see above). * @return bool Success */ public function move(string $to, array $options = []): bool diff --git a/app/vendor/cakephp/cakephp/src/Form/Form.php b/app/vendor/cakephp/cakephp/src/Form/Form.php index 41563e25..9e812235 100644 --- a/app/vendor/cakephp/cakephp/src/Form/Form.php +++ b/app/vendor/cakephp/cakephp/src/Form/Form.php @@ -123,7 +123,7 @@ public function __construct(?EventManager $eventManager = null) * * - Form.buildValidator => buildValidator * - * @return array + * @return array */ public function implementedEvents(): array { @@ -194,7 +194,7 @@ public function schema(?Schema $schema = null): Schema * A hook method intended to be implemented by subclasses. * * You can use this method to define the schema using - * the methods on Cake\Form\Schema, or loads a pre-defined + * the methods on {@link \Cake\Form\Schema}, or loads a pre-defined * schema from a concrete class. * * @param \Cake\Form\Schema $schema The schema to customize. @@ -209,12 +209,14 @@ protected function _buildSchema(Schema $schema): Schema * Used to check if $data passes this form's validation. * * @param array $data The data to check. - * @return bool Whether or not the data is valid. + * @param string|null $validator Validator name. + * @return bool Whether the data is valid. + * @throws \RuntimeException If validator is invalid. */ - public function validate(array $data): bool + public function validate(array $data, ?string $validator = null): bool { - $validator = $this->getValidator(); - $this->_errors = $validator->validate($data); + $this->_errors = $this->getValidator($validator ?: static::DEFAULT_VALIDATOR) + ->validate($data); return count($this->_errors) === 0; } @@ -261,19 +263,29 @@ public function setErrors(array $errors) * the action of the form. This may be sending email, interacting * with a remote API, or anything else you may need. * + * ### Options: + * + * - validate: Set to `false` to disable validation. Can also be a string of the validator ruleset to be applied. + * Defaults to `true`/`'default'`. + * * @param array $data Form data. + * @param array $options List of options. * @return bool False on validation failure, otherwise returns the * result of the `_execute()` method. */ - public function execute(array $data): bool + public function execute(array $data, array $options = []): bool { $this->_data = $data; - if (!$this->validate($data)) { - return false; + $options += ['validate' => true]; + + if ($options['validate'] === false) { + return $this->_execute($data); } - return $this->_execute($data); + $validator = $options['validate'] === true ? static::DEFAULT_VALIDATOR : $options['validate']; + + return $this->validate($data, $validator) ? $this->_execute($data) : false; } /** @@ -308,7 +320,7 @@ public function getData(?string $field = null) /** * Saves a variable or an associative array of variables for use inside form data. * - * @param string|array $name The key to write, can be a dot notation value. + * @param array|string $name The key to write, can be a dot notation value. * Alternatively can be an array containing key(s) and value(s). * @param mixed $value Value to set for var * @return $this @@ -344,7 +356,7 @@ public function setData(array $data) /** * Get the printable version of a Form instance. * - * @return array + * @return array */ public function __debugInfo(): array { diff --git a/app/vendor/cakephp/cakephp/src/Form/FormProtector.php b/app/vendor/cakephp/cakephp/src/Form/FormProtector.php index e0776ce8..757cfeba 100644 --- a/app/vendor/cakephp/cakephp/src/Form/FormProtector.php +++ b/app/vendor/cakephp/cakephp/src/Form/FormProtector.php @@ -42,7 +42,7 @@ class FormProtector /** * Unlocked fields. * - * @var array + * @var array */ protected $unlockedFields = []; @@ -53,18 +53,6 @@ class FormProtector */ protected $debugMessage; - /** - * Construct. - * - * @param array $data Data array, can contain key `unlockedFields` with list of unlocked fields. - */ - public function __construct(array $data = []) - { - if (!empty($data['unlockedFields'])) { - $this->unlockedFields = $data['unlockedFields']; - } - } - /** * Validate submitted form data. * @@ -104,10 +92,22 @@ public function validate($formData, string $url, string $sessionId): bool return false; } + /** + * Construct. + * + * @param array $data Data array, can contain key `unlockedFields` with list of unlocked fields. + */ + public function __construct(array $data = []) + { + if (!empty($data['unlockedFields'])) { + $this->unlockedFields = $data['unlockedFields']; + } + } + /** * Determine which fields of a form should be used for hash. * - * @param string|array $field Reference to field to be secured. Can be dot + * @param array|string $field Reference to field to be secured. Can be dot * separated string to indicate nesting or array of fieldname parts. * @param bool $lock Whether this field should be part of the validation * or excluded as part of the unlockedFields. Default `true`. @@ -159,7 +159,7 @@ public function addField($field, bool $lock = true, $value = null) * fieldname parts like ['Model', 'field'] is returned. * * @param string $name The form inputs name attribute. - * @return string[] Array of field name params like ['Model.field'] or + * @return array Array of field name params like ['Model.field'] or * ['Model', 'field'] for array fields or empty array if $name is empty. */ protected function getFieldNameArray(string $name): array @@ -269,8 +269,8 @@ protected function extractToken($formData): ?string /** * Return hash parts for the token generation * - * @param array $formData Form data. - * @return array + * @param array $formData Form data. + * @return array * @psalm-return array{fields: array, unlockedFields: array} */ protected function extractHashParts(array $formData): array @@ -360,7 +360,7 @@ protected function extractFields(array $formData): array * Get the sorted unlocked string * * @param array $formData Data array - * @return string[] + * @return array */ protected function sortedUnlockedFields(array $formData): array { @@ -380,7 +380,7 @@ protected function sortedUnlockedFields(array $formData): array * * @param string $url Form URL. * @param string $sessionId Session Id. - * @return array The token data. + * @return array The token data. * @psalm-return array{fields: string, unlocked: string, debug: string} */ public function buildTokenData(string $url = '', string $sessionId = ''): array @@ -422,7 +422,7 @@ public function buildTokenData(string $url = '', string $sessionId = ''): array * Generate validation hash. * * @param array $fields Fields list. - * @param array $unlockedFields Unlocked fields. + * @param array $unlockedFields Unlocked fields. * @param string $url Form URL. * @param string $sessionId Session Id. * @return string @@ -495,7 +495,7 @@ protected function debugTokenNotMatching(array $formData, array $hashParts): str * @param string $stringKeyMessage Message string if tampered found in * data fields indexed by string (protected). * @param string $missingMessage Message string if missing field - * @return string[] Messages + * @return array Messages */ protected function debugCheckFields( array $dataFields, @@ -522,7 +522,7 @@ protected function debugCheckFields( * @param string $intKeyMessage Message string if unexpected found in data fields indexed by int (not protected) * @param string $stringKeyMessage Message string if tampered found in * data fields indexed by string (protected) - * @return string[] Error messages + * @return array Error messages */ protected function matchExistingFields( array $dataFields, @@ -578,7 +578,7 @@ protected function debugExpectedFields(array $expectedFields = [], string $missi /** * Return debug info * - * @return array + * @return array */ public function __debugInfo(): array { diff --git a/app/vendor/cakephp/cakephp/src/Form/Schema.php b/app/vendor/cakephp/cakephp/src/Form/Schema.php index 9f9ae2fe..ae8f7501 100644 --- a/app/vendor/cakephp/cakephp/src/Form/Schema.php +++ b/app/vendor/cakephp/cakephp/src/Form/Schema.php @@ -24,14 +24,14 @@ class Schema /** * The fields in this schema. * - * @var array + * @var array> */ protected $_fields = []; /** * The default values for fields. * - * @var array + * @var array */ protected $_fieldDefaults = [ 'type' => null, @@ -43,7 +43,7 @@ class Schema /** * Add multiple fields to the schema. * - * @param array $fields The fields to add. + * @param array|string> $fields The fields to add. * @return $this */ public function addFields(array $fields) @@ -59,7 +59,7 @@ public function addFields(array $fields) * Adds a field to the schema. * * @param string $name The field name. - * @param string|array $attrs The attributes for the field, or the type + * @param array|string $attrs The attributes for the field, or the type * as a string. * @return $this */ @@ -90,7 +90,7 @@ public function removeField(string $name) /** * Get the list of fields in the schema. * - * @return string[] The list of field names. + * @return array The list of field names. */ public function fields(): array { @@ -101,15 +101,11 @@ public function fields(): array * Get the attributes for a given field. * * @param string $name The field name. - * @return array|null The attributes for a field, or null. + * @return array|null The attributes for a field, or null. */ public function field(string $name): ?array { - if (!isset($this->_fields[$name])) { - return null; - } - - return $this->_fields[$name]; + return $this->_fields[$name] ?? null; } /** @@ -132,7 +128,7 @@ public function fieldType(string $name): ?string /** * Get the printable version of this object * - * @return array + * @return array */ public function __debugInfo(): array { diff --git a/app/vendor/cakephp/cakephp/src/Http/BaseApplication.php b/app/vendor/cakephp/cakephp/src/Http/BaseApplication.php index f6c9867a..1b072a71 100644 --- a/app/vendor/cakephp/cakephp/src/Http/BaseApplication.php +++ b/app/vendor/cakephp/cakephp/src/Http/BaseApplication.php @@ -34,6 +34,7 @@ use Cake\Routing\RouteBuilder; use Cake\Routing\Router; use Cake\Routing\RoutingApplicationInterface; +use Closure; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; @@ -87,8 +88,8 @@ abstract class BaseApplication implements * Constructor * * @param string $configDir The directory the bootstrap configuration is held in. - * @param \Cake\Event\EventManagerInterface $eventManager Application event manager instance. - * @param \Cake\Http\ControllerFactoryInterface $controllerFactory Controller factory. + * @param \Cake\Event\EventManagerInterface|null $eventManager Application event manager instance. + * @param \Cake\Http\ControllerFactoryInterface|null $controllerFactory Controller factory. */ public function __construct( string $configDir, @@ -139,8 +140,8 @@ public function addPlugin($name, array $config = []) * * If it isn't available, ignore it. * - * @param string|\Cake\Core\PluginInterface $name The plugin name or plugin object. - * @param array $config The configuration data for the plugin if using a string for $name + * @param \Cake\Core\PluginInterface|string $name The plugin name or plugin object. + * @param array $config The configuration data for the plugin if using a string for $name * @return $this */ public function addOptionalPlugin($name, array $config = []) @@ -185,7 +186,7 @@ public function pluginBootstrap(): void /** * {@inheritDoc} * - * By default this will load `config/routes.php` for ease of use and backwards compatibility. + * By default, this will load `config/routes.php` for ease of use and backwards compatibility. * * @param \Cake\Routing\RouteBuilder $routes A route builder to add routes into. * @return void @@ -194,7 +195,10 @@ public function routes(RouteBuilder $routes): void { // Only load routes if the router is empty if (!Router::routes()) { - require $this->configDir . 'routes.php'; + $return = require $this->configDir . 'routes.php'; + if ($return instanceof Closure) { + $return($routes); + } } } @@ -213,7 +217,7 @@ public function pluginRoutes(RouteBuilder $routes): RouteBuilder /** * Define the console commands for an application. * - * By default all commands in CakePHP, plugins and the application will be + * By default, all commands in CakePHP, plugins and the application will be * loaded using conventions based names. * * @param \Cake\Console\CommandCollection $commands The CommandCollection to add commands into. diff --git a/app/vendor/cakephp/cakephp/src/Http/Client.php b/app/vendor/cakephp/cakephp/src/Http/Client.php index 27791140..e2dbd16a 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Client.php +++ b/app/vendor/cakephp/cakephp/src/Http/Client.php @@ -19,6 +19,7 @@ use Cake\Core\Exception\CakeException; use Cake\Core\InstanceConfigTrait; use Cake\Http\Client\Adapter\Curl; +use Cake\Http\Client\Adapter\Mock as MockAdapter; use Cake\Http\Client\Adapter\Stream; use Cake\Http\Client\AdapterInterface; use Cake\Http\Client\Request; @@ -61,12 +62,12 @@ * CookieCollection using cookies() * * You can use the 'cookieJar' constructor option to provide a custom - * cookie jar instance you've restored from cache/disk. By default - * an empty instance of Cake\Http\Client\CookieCollection will be created. + * cookie jar instance you've restored from cache/disk. By default, + * an empty instance of {@link \Cake\Http\Client\CookieCollection} will be created. * * ### Sending request bodies * - * By default any POST/PUT/PATCH/DELETE request with $data will + * By default, any POST/PUT/PATCH/DELETE request with $data will * send their data as `application/x-www-form-urlencoded` unless * there are attached files. In that case `multipart/form-data` * will be used. @@ -107,9 +108,10 @@ class Client implements ClientInterface /** * Default configuration for the client. * - * @var array + * @var array */ protected $_defaultConfig = [ + 'auth' => null, 'adapter' => null, 'host' => null, 'port' => null, @@ -134,6 +136,13 @@ class Client implements ClientInterface */ protected $_cookies; + /** + * Mock adapter for stubbing requests in tests. + * + * @var \Cake\Http\Client\Adapter\Mock|null + */ + protected static $_mockAdapter; + /** * Adapter for sending requests. * @@ -153,9 +162,9 @@ class Client implements ClientInterface * - scheme - The default scheme/protocol to use. Defaults to http. * - basePath - A path to append to the domain to use. (/api/v1/) * - timeout - The timeout in seconds. Defaults to 30 - * - ssl_verify_peer - Whether or not SSL certificates should be validated. + * - ssl_verify_peer - Whether SSL certificates should be validated. * Defaults to true. - * - ssl_verify_peer_name - Whether or not peer names should be validated. + * - ssl_verify_peer_name - Whether peer names should be validated. * Defaults to true. * - ssl_verify_depth - The maximum certificate chain depth to traverse. * Defaults to 5. @@ -166,8 +175,12 @@ class Client implements ClientInterface * \Cake\Http\Client\Adapter\Curl if `curl` extension is loaded else * \Cake\Http\Client\Adapter\Stream. * - protocolVersion - The HTTP protocol version to use. Defaults to 1.1 + * - auth - The authentication credentials to use. If a `username` and `password` + * key are provided without a `type` key Basic authentication will be assumed. + * You can use the `type` key to define the authentication adapter classname + * to use. Short class names are resolved to the `Http\Client\Auth` namespace. * - * @param array $config Config options for scoped clients. + * @param array $config Config options for scoped clients. * @throws \InvalidArgumentException */ public function __construct(array $config = []) @@ -208,7 +221,7 @@ public function __construct(array $config = []) * too. If a path is included in the URL, the client instance will build urls with it prepended. * Other parts of the url string are ignored. * - * @param string $url A string URL e.g. https://example.com + * @param string $url A string URL e.g. https://example.com * @return static * @throws \InvalidArgumentException */ @@ -271,7 +284,7 @@ public function addCookie(CookieInterface $cookie) * * @param string $url The url or path you want to request. * @param array|string $data The query data you want to send. - * @param array $options Additional options for the request. + * @param array $options Additional options for the request. * @return \Cake\Http\Client\Response */ public function get(string $url, $data = [], array $options = []): Response @@ -297,7 +310,7 @@ public function get(string $url, $data = [], array $options = []): Response * * @param string $url The url or path you want to request. * @param mixed $data The post data you want to send. - * @param array $options Additional options for the request. + * @param array $options Additional options for the request. * @return \Cake\Http\Client\Response */ public function post(string $url, $data = [], array $options = []): Response @@ -313,7 +326,7 @@ public function post(string $url, $data = [], array $options = []): Response * * @param string $url The url or path you want to request. * @param mixed $data The request data you want to send. - * @param array $options Additional options for the request. + * @param array $options Additional options for the request. * @return \Cake\Http\Client\Response */ public function put(string $url, $data = [], array $options = []): Response @@ -329,7 +342,7 @@ public function put(string $url, $data = [], array $options = []): Response * * @param string $url The url or path you want to request. * @param mixed $data The request data you want to send. - * @param array $options Additional options for the request. + * @param array $options Additional options for the request. * @return \Cake\Http\Client\Response */ public function patch(string $url, $data = [], array $options = []): Response @@ -345,7 +358,7 @@ public function patch(string $url, $data = [], array $options = []): Response * * @param string $url The url or path you want to request. * @param mixed $data The request data you want to send. - * @param array $options Additional options for the request. + * @param array $options Additional options for the request. * @return \Cake\Http\Client\Response */ public function options(string $url, $data = [], array $options = []): Response @@ -361,7 +374,7 @@ public function options(string $url, $data = [], array $options = []): Response * * @param string $url The url or path you want to request. * @param mixed $data The request data you want to send. - * @param array $options Additional options for the request. + * @param array $options Additional options for the request. * @return \Cake\Http\Client\Response */ public function trace(string $url, $data = [], array $options = []): Response @@ -377,7 +390,7 @@ public function trace(string $url, $data = [], array $options = []): Response * * @param string $url The url or path you want to request. * @param mixed $data The request data you want to send. - * @param array $options Additional options for the request. + * @param array $options Additional options for the request. * @return \Cake\Http\Client\Response */ public function delete(string $url, $data = [], array $options = []): Response @@ -393,7 +406,7 @@ public function delete(string $url, $data = [], array $options = []): Response * * @param string $url The url or path you want to request. * @param array $data The query string data you want to send. - * @param array $options Additional options for the request. + * @param array $options Additional options for the request. * @return \Cake\Http\Client\Response */ public function head(string $url, array $data = [], array $options = []): Response @@ -410,7 +423,7 @@ public function head(string $url, array $data = [], array $options = []): Respon * @param string $method HTTP method. * @param string $url URL to request. * @param mixed $data The request body. - * @param array $options The options to use. Contains auth, proxy, etc. + * @param array $options The options to use. Contains auth, proxy, etc. * @return \Cake\Http\Client\Response */ protected function _doRequest(string $method, string $url, $data, $options): Response @@ -428,7 +441,7 @@ protected function _doRequest(string $method, string $url, $data, $options): Res /** * Does a recursive merge of the parameter with the scope config. * - * @param array $options Options to merge. + * @param array $options Options to merge. * @return array Options merged with set config. */ protected function _mergeOptions(array $options): array @@ -455,7 +468,7 @@ public function sendRequest(RequestInterface $request): ResponseInterface * handcrafted Request objects. * * @param \Psr\Http\Message\RequestInterface $request The request to send. - * @param array $options Additional options to use. + * @param array $options Additional options to use. * @return \Cake\Http\Client\Response */ public function send(RequestInterface $request, array $options = []): Response @@ -488,16 +501,60 @@ public function send(RequestInterface $request, array $options = []): Response return $response; } + /** + * Clear all mocked responses + * + * @return void + */ + public static function clearMockResponses(): void + { + static::$_mockAdapter = null; + } + + /** + * Add a mocked response. + * + * Mocked responses are stored in an adapter that is called + * _before_ the network adapter is called. + * + * ### Matching Requests + * + * TODO finish this. + * + * ### Options + * + * - `match` An additional closure to match requests with. + * + * @param string $method The HTTP method being mocked. + * @param string $url The URL being matched. See above for examples. + * @param \Cake\Http\Client\Response $response The response that matches the request. + * @param array $options See above. + * @return void + */ + public static function addMockResponse(string $method, string $url, Response $response, array $options = []): void + { + if (!static::$_mockAdapter) { + static::$_mockAdapter = new MockAdapter(); + } + $request = new Request($url, $method); + static::$_mockAdapter->addResponse($request, $response, $options); + } + /** * Send a request without redirection. * * @param \Psr\Http\Message\RequestInterface $request The request to send. - * @param array $options Additional options to use. + * @param array $options Additional options to use. * @return \Cake\Http\Client\Response */ protected function _sendRequest(RequestInterface $request, array $options): Response { - $responses = $this->_adapter->send($request, $options); + if (static::$_mockAdapter) { + $responses = static::$_mockAdapter->send($request, $options); + } + if (empty($responses)) { + $responses = $this->_adapter->send($request, $options); + } foreach ($responses as $response) { $this->_cookies = $this->_cookies->addFromResponse($response, $request); } @@ -509,8 +566,8 @@ protected function _sendRequest(RequestInterface $request, array $options): Resp * Generate a URL based on the scoped client options. * * @param string $url Either a full URL or just the path. - * @param string|array $query The query data for the URL. - * @param array $options The config options stored with Client::config() + * @param array|string $query The query data for the URL. + * @param array $options The config options stored with Client::config() * @return string A complete url with scheme, port, host, and path. */ public function buildUrl(string $url, $query = [], array $options = []): string @@ -518,11 +575,6 @@ public function buildUrl(string $url, $query = [], array $options = []): string if (empty($options) && empty($query)) { return $url; } - if ($query) { - $q = strpos($url, '?') === false ? '?' : '&'; - $url .= $q; - $url .= is_string($query) ? $query : http_build_query($query); - } $defaults = [ 'host' => null, 'port' => null, @@ -532,6 +584,12 @@ public function buildUrl(string $url, $query = [], array $options = []): string ]; $options += $defaults; + if ($query) { + $q = strpos($url, '?') === false ? '?' : '&'; + $url .= $q; + $url .= is_string($query) ? $query : http_build_query($query, '', '&', PHP_QUERY_RFC3986); + } + if ($options['protocolRelative'] && preg_match('#^//#', $url)) { $url = $options['scheme'] . ':' . $url; } @@ -561,11 +619,12 @@ public function buildUrl(string $url, $query = [], array $options = []): string * @param string $method HTTP method name. * @param string $url The url including query string. * @param mixed $data The request body. - * @param array $options The options to use. Contains auth, proxy, etc. + * @param array $options The options to use. Contains auth, proxy, etc. * @return \Cake\Http\Client\Request */ protected function _createRequest(string $method, string $url, $data, $options): Request { + /** @var array $headers */ $headers = (array)($options['headers'] ?? []); if (isset($options['type'])) { $headers = array_merge($headers, $this->_typeHeaders($options['type'])); @@ -575,7 +634,6 @@ protected function _createRequest(string $method, string $url, $data, $options): } $request = new Request($url, $method, $headers, $data); - /** @var \Cake\Http\Client\Request $request */ $request = $request->withProtocolVersion($this->getConfig('protocolVersion')); $cookies = $options['cookies'] ?? []; /** @var \Cake\Http\Client\Request $request */ @@ -594,10 +652,11 @@ protected function _createRequest(string $method, string $url, $data, $options): * Returns headers for Accept/Content-Type based on a short type * or full mime-type. * + * @phpstan-param non-empty-string $type * @param string $type short type alias or full mimetype. - * @return string[] Headers to set on the request. + * @return array Headers to set on the request. * @throws \Cake\Core\Exception\CakeException When an unknown type alias is used. - * @psalm-return array{Accept: string, Content-Type: string} + * @psalm-return array */ protected function _typeHeaders(string $type): array { @@ -628,7 +687,7 @@ protected function _typeHeaders(string $type): array * and use its methods to add headers. * * @param \Cake\Http\Client\Request $request The request to modify. - * @param array $options Array of options containing the 'auth' key. + * @param array $options Array of options containing the 'auth' key. * @return \Cake\Http\Client\Request The updated request object. */ protected function _addAuthentication(Request $request, array $options): Request @@ -647,7 +706,7 @@ protected function _addAuthentication(Request $request, array $options): Request * and use its methods to add headers. * * @param \Cake\Http\Client\Request $request The request to modify. - * @param array $options Array of options containing the 'proxy' key. + * @param array $options Array of options containing the 'proxy' key. * @return \Cake\Http\Client\Request The updated request object. */ protected function _addProxy(Request $request, array $options): Request @@ -666,7 +725,7 @@ protected function _addProxy(Request $request, array $options): Request * authentication strategy handler. * * @param array $auth The authentication options to use. - * @param array $options The overall request options to use. + * @param array $options The overall request options to use. * @return object Authentication strategy instance. * @throws \Cake\Core\Exception\CakeException when an invalid strategy is chosen. */ diff --git a/app/vendor/cakephp/cakephp/src/Http/Client/Adapter/Curl.php b/app/vendor/cakephp/cakephp/src/Http/Client/Adapter/Curl.php index 7fc5df08..fba54c48 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Client/Adapter/Curl.php +++ b/app/vendor/cakephp/cakephp/src/Http/Client/Adapter/Curl.php @@ -28,7 +28,7 @@ /** * Implements sending Cake\Http\Client\Request via ext/curl. * - * In addition to the standard options documented in Cake\Http\Client, + * In addition to the standard options documented in {@link \Cake\Http\Client}, * this adapter supports all available curl options. Additional curl options * can be set via the `curl` option key when making requests or configuring * a client. @@ -77,7 +77,7 @@ public function send(RequestInterface $request, array $options): array * Convert client options into curl options. * * @param \Psr\Http\Message\RequestInterface $request The request. - * @param array $options The client options + * @param array $options The client options * @return array */ public function buildOptions(RequestInterface $request, array $options): array @@ -117,7 +117,7 @@ public function buildOptions(RequestInterface $request, array $options): array $body->rewind(); $out[CURLOPT_POSTFIELDS] = $body->getContents(); // GET requests with bodies require custom request to be used. - if (strlen($out[CURLOPT_POSTFIELDS]) && isset($out[CURLOPT_HTTPGET])) { + if ($out[CURLOPT_POSTFIELDS] !== '' && isset($out[CURLOPT_HTTPGET])) { $out[CURLOPT_CUSTOMREQUEST] = 'get'; } if ($out[CURLOPT_POSTFIELDS] === '') { @@ -193,7 +193,7 @@ protected function getProtocolVersion(RequestInterface $request): int * * @param resource|\CurlHandle $handle Curl handle * @param string $responseData string The response data from curl_exec - * @return \Cake\Http\Client\Response[] + * @return array<\Cake\Http\Client\Response> * @psalm-suppress UndefinedDocblockClass */ protected function createResponse($handle, $responseData): array diff --git a/app/vendor/cakephp/cakephp/src/Http/Client/Adapter/Stream.php b/app/vendor/cakephp/cakephp/src/Http/Client/Adapter/Stream.php index 761b23a2..18bfa0af 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Client/Adapter/Stream.php +++ b/app/vendor/cakephp/cakephp/src/Http/Client/Adapter/Stream.php @@ -90,7 +90,7 @@ public function send(RequestInterface $request, array $options): array * * @param array $headers The list of headers from the request(s) * @param string $content The response content. - * @return \Cake\Http\Client\Response[] The list of responses from the request(s) + * @return array<\Cake\Http\Client\Response> The list of responses from the request(s) */ public function createResponses(array $headers, string $content): array { @@ -117,7 +117,7 @@ public function createResponses(array $headers, string $content): array * Build the stream context out of the request object. * * @param \Psr\Http\Message\RequestInterface $request The request to build context from. - * @param array $options Additional request options. + * @param array $options Additional request options. * @return void */ protected function _buildContext(RequestInterface $request, array $options): void @@ -143,7 +143,7 @@ protected function _buildContext(RequestInterface $request, array $options): voi * Creates cookies & headers. * * @param \Psr\Http\Message\RequestInterface $request The request being sent. - * @param array $options Array of options to use. + * @param array $options Array of options to use. * @return void */ protected function _buildHeaders(RequestInterface $request, array $options): void @@ -159,20 +159,15 @@ protected function _buildHeaders(RequestInterface $request, array $options): voi * Builds the request content based on the request object. * * If the $request->body() is a string, it will be used as is. - * Array data will be processed with Cake\Http\Client\FormData + * Array data will be processed with {@link \Cake\Http\Client\FormData} * * @param \Psr\Http\Message\RequestInterface $request The request being sent. - * @param array $options Array of options to use. + * @param array $options Array of options to use. * @return void */ protected function _buildContent(RequestInterface $request, array $options): void { $body = $request->getBody(); - if (empty($body)) { - $this->_contextOptions['content'] = ''; - - return; - } $body->rewind(); $this->_contextOptions['content'] = $body->getContents(); } @@ -181,7 +176,7 @@ protected function _buildContent(RequestInterface $request, array $options): voi * Build miscellaneous options for the request. * * @param \Psr\Http\Message\RequestInterface $request The request being sent. - * @param array $options Array of options to use. + * @param array $options Array of options to use. * @return void */ protected function _buildOptions(RequestInterface $request, array $options): void @@ -206,7 +201,7 @@ protected function _buildOptions(RequestInterface $request, array $options): voi * Build SSL options for the request. * * @param \Psr\Http\Message\RequestInterface $request The request being sent. - * @param array $options Array of options to use. + * @param array $options Array of options to use. * @return void */ protected function _buildSslContext(RequestInterface $request, array $options): void diff --git a/app/vendor/cakephp/cakephp/src/Http/Client/AdapterInterface.php b/app/vendor/cakephp/cakephp/src/Http/Client/AdapterInterface.php index b64c81da..8c6de39c 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Client/AdapterInterface.php +++ b/app/vendor/cakephp/cakephp/src/Http/Client/AdapterInterface.php @@ -26,8 +26,8 @@ interface AdapterInterface * Send a request and get a response back. * * @param \Psr\Http\Message\RequestInterface $request The request object to send. - * @param array $options Array of options for the stream. - * @return \Cake\Http\Client\Response[] Array of populated Response objects + * @param array $options Array of options for the stream. + * @return array<\Cake\Http\Client\Response> Array of populated Response objects */ public function send(RequestInterface $request, array $options): array; } diff --git a/app/vendor/cakephp/cakephp/src/Http/Client/Auth/Basic.php b/app/vendor/cakephp/cakephp/src/Http/Client/Auth/Basic.php index 95e63645..0df928b3 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Client/Auth/Basic.php +++ b/app/vendor/cakephp/cakephp/src/Http/Client/Auth/Basic.php @@ -20,7 +20,7 @@ /** * Basic authentication adapter for Cake\Http\Client * - * Generally not directly constructed, but instead used by Cake\Http\Client + * Generally not directly constructed, but instead used by {@link \Cake\Http\Client} * when $options['auth']['type'] is 'basic' */ class Basic diff --git a/app/vendor/cakephp/cakephp/src/Http/Client/Auth/Digest.php b/app/vendor/cakephp/cakephp/src/Http/Client/Auth/Digest.php index ef313371..577b1b78 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Client/Auth/Digest.php +++ b/app/vendor/cakephp/cakephp/src/Http/Client/Auth/Digest.php @@ -21,7 +21,7 @@ /** * Digest authentication adapter for Cake\Http\Client * - * Generally not directly constructed, but instead used by Cake\Http\Client + * Generally not directly constructed, but instead used by {@link \Cake\Http\Client} * when $options['auth']['type'] is 'digest' */ class Digest @@ -48,7 +48,7 @@ public function __construct(Client $client, ?array $options = null) * Add Authorization header to the request. * * @param \Cake\Http\Client\Request $request The request object. - * @param array $credentials Authentication credentials. + * @param array $credentials Authentication credentials. * @return \Cake\Http\Client\Request The updated request. * @see https://www.ietf.org/rfc/rfc2617.txt */ @@ -110,7 +110,7 @@ protected function _getServerInfo(Request $request, array $credentials): array * Generate the header Authorization * * @param \Cake\Http\Client\Request $request The request object. - * @param array $credentials Authentication credentials. + * @param array $credentials Authentication credentials. * @return string */ protected function _generateHeader(Request $request, array $credentials): string diff --git a/app/vendor/cakephp/cakephp/src/Http/Client/Auth/Oauth.php b/app/vendor/cakephp/cakephp/src/Http/Client/Auth/Oauth.php index f066ee02..f6edf278 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Client/Auth/Oauth.php +++ b/app/vendor/cakephp/cakephp/src/Http/Client/Auth/Oauth.php @@ -28,7 +28,7 @@ * provider. It only handles make client requests *after* you have obtained the Oauth * tokens. * - * Generally not directly constructed, but instead used by Cake\Http\Client + * Generally not directly constructed, but instead used by {@link \Cake\Http\Client} * when $options['auth']['type'] is 'oauth' */ class Oauth @@ -220,8 +220,12 @@ protected function _rsaSha1(Request $request, array $credentials): string $credentials['privateKeyPassphrase'] = $passphrase; } $privateKey = openssl_pkey_get_private($credentials['privateKey'], $credentials['privateKeyPassphrase']); + $this->checkSslError(); + $signature = ''; openssl_sign($baseString, $signature, $privateKey); + $this->checkSslError(); + if (PHP_MAJOR_VERSION < 8) { openssl_free_key($privateKey); } @@ -367,4 +371,21 @@ protected function _encode(string $value): string { return str_replace(['%7E', '+'], ['~', ' '], rawurlencode($value)); } + + /** + * Check for SSL errors and raise if one is encountered. + * + * @return void + */ + protected function checkSslError(): void + { + $error = ''; + while ($text = openssl_error_string()) { + $error .= $text; + } + + if (strlen($error) > 0) { + throw new RuntimeException('openssl error: ' . $error); + } + } } diff --git a/app/vendor/cakephp/cakephp/src/Http/Client/FormData.php b/app/vendor/cakephp/cakephp/src/Http/Client/FormData.php index 0e87c1fb..286b842e 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Client/FormData.php +++ b/app/vendor/cakephp/cakephp/src/Http/Client/FormData.php @@ -35,14 +35,14 @@ class FormData implements Countable protected $_boundary; /** - * Whether or not this formdata object has attached files. + * Whether this formdata object has attached files. * * @var bool */ protected $_hasFile = false; /** - * Whether or not this formdata object has a complex part. + * Whether this formdata object has a complex part. * * @var bool */ @@ -51,7 +51,7 @@ class FormData implements Countable /** * The parts in the form data. * - * @var \Cake\Http\Client\FormDataPart[] + * @var array<\Cake\Http\Client\FormDataPart> */ protected $_parts = []; @@ -91,7 +91,7 @@ public function newPart(string $name, string $value): FormDataPart * If the $value is an array, multiple parts will be added. * Files will be read from their current position and saved in memory. * - * @param string|\Cake\Http\Client\FormDataPart $name The name of the part to add, + * @param \Cake\Http\Client\FormDataPart|string $name The name of the part to add, * or the part data object. * @param mixed $value The value for the part. * @return $this @@ -196,10 +196,10 @@ public function count(): int } /** - * Check whether or not the current payload + * Check whether the current payload * has any files. * - * @return bool Whether or not there is a file in this payload. + * @return bool Whether there is a file in this payload. */ public function hasFile(): bool { @@ -207,13 +207,13 @@ public function hasFile(): bool } /** - * Check whether or not the current payload + * Check whether the current payload * is multipart. * * A payload will become multipart when you add files * or use add() with a Part instance. * - * @return bool Whether or not the payload is multipart. + * @return bool Whether the payload is multipart. */ public function isMultipart(): bool { diff --git a/app/vendor/cakephp/cakephp/src/Http/Client/Message.php b/app/vendor/cakephp/cakephp/src/Http/Client/Message.php index a23282d2..59994e03 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Client/Message.php +++ b/app/vendor/cakephp/cakephp/src/Http/Client/Message.php @@ -86,6 +86,13 @@ class Message */ public const STATUS_TEMPORARY_REDIRECT = 307; + /** + * HTTP 308 code + * + * @var int + */ + public const STATUS_PERMANENT_REDIRECT = 308; + /** * HTTP GET method * diff --git a/app/vendor/cakephp/cakephp/src/Http/Client/Request.php b/app/vendor/cakephp/cakephp/src/Http/Client/Request.php index 9ae13cb0..752eba4a 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Client/Request.php +++ b/app/vendor/cakephp/cakephp/src/Http/Client/Request.php @@ -34,6 +34,7 @@ class Request extends Message implements RequestInterface * * Provides backwards compatible defaults for some properties. * + * @phpstan-param array $headers * @param string $url The request URL * @param string $method The HTTP method to use. * @param array $headers The HTTP headers to set. @@ -45,7 +46,7 @@ public function __construct(string $url = '', string $method = self::METHOD_GET, $this->uri = $this->createUri($url); $headers += [ 'Connection' => 'close', - 'User-Agent' => 'CakePHP', + 'User-Agent' => ini_get('user_agent') ?: 'CakePHP', ]; $this->addHeaders($headers); @@ -59,7 +60,8 @@ public function __construct(string $url = '', string $method = self::METHOD_GET, /** * Add an array of headers to the request. * - * @param array $headers The headers to add. + * @phpstan-param array $headers + * @param array $headers The headers to add. * @return void */ protected function addHeaders(array $headers): void @@ -74,10 +76,10 @@ protected function addHeaders(array $headers): void /** * Set the body/payload for the message. * - * Array data will be serialized with Cake\Http\FormData, + * Array data will be serialized with {@link \Cake\Http\FormData}, * and the content-type will be set. * - * @param string|array $content The body for the request. + * @param array|string $content The body for the request. * @return $this */ protected function setContent($content) @@ -85,7 +87,9 @@ protected function setContent($content) if (is_array($content)) { $formData = new FormData(); $formData->addMany($content); - $this->addHeaders(['Content-Type' => $formData->contentType()]); + /** @phpstan-var array $headers */ + $headers = ['Content-Type' => $formData->contentType()]; + $this->addHeaders($headers); $content = (string)$formData; } diff --git a/app/vendor/cakephp/cakephp/src/Http/Client/Response.php b/app/vendor/cakephp/cakephp/src/Http/Client/Response.php index e89ff269..74b3818b 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Client/Response.php +++ b/app/vendor/cakephp/cakephp/src/Http/Client/Response.php @@ -25,7 +25,7 @@ /** * Implements methods for HTTP responses. * - * All of the following examples assume that `$response` is an + * All the following examples assume that `$response` is an * instance of this class. * * ### Get header values @@ -189,6 +189,7 @@ protected function _parseHeaders(array $headers): void } [$name, $value] = explode(':', $value, 2); $value = trim($value); + /** @phpstan-var non-empty-string $name */ $name = trim($name); $normalized = strtolower($name); @@ -234,6 +235,7 @@ public function isRedirect(): bool static::STATUS_FOUND, static::STATUS_SEE_OTHER, static::STATUS_TEMPORARY_REDIRECT, + static::STATUS_PERMANENT_REDIRECT, ]; return in_array($this->code, $codes, true) && @@ -324,7 +326,7 @@ public function getCookieCollection(): CookieCollection * Get the value of a single cookie. * * @param string $name The name of the cookie value. - * @return string|array|null Either the cookie's value or null when the cookie is undefined. + * @return array|string|null Either the cookie's value or null when the cookie is undefined. */ public function getCookie(string $name) { @@ -377,7 +379,7 @@ protected function _getCookies(): array $this->buildCookieCollection(); $out = []; - /** @var \Cake\Http\Cookie\Cookie[] $cookies */ + /** @var array<\Cake\Http\Cookie\Cookie> $cookies */ $cookies = $this->cookies; foreach ($cookies as $cookie) { $out[$cookie->getName()] = $cookie->toArray(); @@ -454,7 +456,7 @@ protected function _getXml(): ?SimpleXMLElement /** * Provides magic __get() support. * - * @return string[] + * @return array */ protected function _getHeaders(): array { diff --git a/app/vendor/cakephp/cakephp/src/Http/Cookie/Cookie.php b/app/vendor/cakephp/cakephp/src/Http/Cookie/Cookie.php index 1eaae0a6..9ab9ed3c 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Cookie/Cookie.php +++ b/app/vendor/cakephp/cakephp/src/Http/Cookie/Cookie.php @@ -59,12 +59,12 @@ class Cookie implements CookieInterface /** * Raw Cookie value. * - * @var string|array + * @var array|string */ protected $value = ''; /** - * Whether or not a JSON value has been expanded into an array. + * Whether a JSON value has been expanded into an array. * * @var bool */ @@ -115,8 +115,8 @@ class Cookie implements CookieInterface /** * Default attributes for a cookie. * - * @var array - * @see \Cake\Cookie\Cookie::setDefaults() + * @var array + * @see \Cake\Http\Cookie\Cookie::setDefaults() */ protected static $defaults = [ 'expires' => null, @@ -136,7 +136,7 @@ class Cookie implements CookieInterface * * @link http://php.net/manual/en/function.setcookie.php * @param string $name Cookie name - * @param string|array $value Value of the cookie + * @param array|string $value Value of the cookie * @param \DateTime|\DateTimeImmutable|null $expiresAt Expiration time and date * @param string|null $path Path * @param string|null $domain Domain @@ -191,7 +191,7 @@ public function __construct( * - `samesite`: Can be one of `CookieInterface::SAMESITE_LAX`, `CookieInterface::SAMESITE_STRICT`, * `CookieInterface::SAMESITE_NONE` or `null`. Defaults to `null`. * - * @param array $options Default options. + * @param array $options Default options. * @return void */ public static function setDefaults(array $options): void @@ -210,8 +210,8 @@ public static function setDefaults(array $options): void * Factory method to create Cookie instances. * * @param string $name Cookie name - * @param string|array $value Value of the cookie - * @param array $options Cookies options. + * @param array|string $value Value of the cookie + * @param array $options Cookies options. * @return static * @see \Cake\Cookie\Cookie::setDefaults() */ @@ -241,7 +241,7 @@ public static function create(string $name, $value, array $options = []) protected static function dateTimeInstance($expires): ?DateTimeInterface { if ($expires === null) { - return $expires; + return null; } if ($expires instanceof DateTimeInterface) { @@ -271,9 +271,9 @@ protected static function dateTimeInstance($expires): ?DateTimeInterface * Create Cookie instance from "set-cookie" header string. * * @param string $cookie Cookie header string. - * @param array $defaults Default attributes. + * @param array $defaults Default attributes. * @return static - * @see \Cake\Cookie\Cookie::setDefaults() + * @see \Cake\Http\Cookie\Cookie::setDefaults() */ public static function createFromHeaderString(string $cookie, array $defaults = []) { @@ -463,7 +463,7 @@ public function withValue($value) /** * Setter for the value attribute. * - * @param string|array $value The value to store. + * @param array|string $value The value to store. * @return void */ protected function _setValue($value): void @@ -732,7 +732,7 @@ public function withoutAddedValue(string $path) * This method will expand serialized complex data, * on first use. * - * @param string $path Path to read the data from + * @param string|null $path Path to read the data from * @return mixed */ public function read(?string $path = null) @@ -807,7 +807,7 @@ protected function _flatten(array $array): string * Maintains reading backwards compatibility with 1.x CookieComponent::_flatten(). * * @param string $string A string containing JSON encoded data, or a bare string. - * @return string|array Map of key and values + * @return array|string Map of key and values */ protected function _expand(string $string) { diff --git a/app/vendor/cakephp/cakephp/src/Http/Cookie/CookieCollection.php b/app/vendor/cakephp/cakephp/src/Http/Cookie/CookieCollection.php index 23b84be4..93057cbe 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Cookie/CookieCollection.php +++ b/app/vendor/cakephp/cakephp/src/Http/Cookie/CookieCollection.php @@ -26,6 +26,7 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Traversable; +use TypeError; /** * Cookie Collection @@ -38,14 +39,14 @@ class CookieCollection implements IteratorAggregate, Countable /** * Cookie objects * - * @var \Cake\Http\Cookie\CookieInterface[] + * @var array<\Cake\Http\Cookie\CookieInterface> */ protected $cookies = []; /** * Constructor * - * @param \Cake\Http\Cookie\CookieInterface[] $cookies Array of cookie objects + * @param array<\Cake\Http\Cookie\CookieInterface> $cookies Array of cookie objects */ public function __construct(array $cookies = []) { @@ -58,8 +59,8 @@ public function __construct(array $cookies = []) /** * Create a Cookie Collection from an array of Set-Cookie Headers * - * @param array $header The array of set-cookie header values. - * @param array $defaults The defaults attributes. + * @param array $header The array of set-cookie header values. + * @param array $defaults The defaults attributes. * @return static */ public static function createFromHeader(array $header, array $defaults = []) @@ -68,7 +69,7 @@ public static function createFromHeader(array $header, array $defaults = []) foreach ($header as $value) { try { $cookies[] = Cookie::createFromHeaderString($value, $defaults); - } catch (Exception $e) { + } catch (Exception | TypeError $e) { // Don't blow up on invalid cookies } } @@ -187,7 +188,7 @@ public function remove(string $name) /** * Checks if only valid cookie objects are in the array * - * @param \Cake\Http\Cookie\CookieInterface[] $cookies Array of cookie objects + * @param array<\Cake\Http\Cookie\CookieInterface> $cookies Array of cookie objects * @return void * @throws \InvalidArgumentException */ @@ -210,8 +211,7 @@ protected function checkCookies(array $cookies): void /** * Gets the iterator * - * @return \Cake\Http\Cookie\CookieInterface[] - * @psalm-return \Traversable + * @return \Traversable */ public function getIterator(): Traversable { @@ -238,10 +238,10 @@ public function addToRequest(RequestInterface $request, array $extraCookies = [] $uri->getHost(), $uri->getPath() ?: '/' ); - $cookies = array_merge($cookies, $extraCookies); + $cookies = $extraCookies + $cookies; $cookiePairs = []; foreach ($cookies as $key => $value) { - $cookie = sprintf('%s=%s', rawurlencode($key), rawurlencode($value)); + $cookie = sprintf('%s=%s', rawurlencode((string)$key), rawurlencode($value)); $size = strlen($cookie); if ($size > 4096) { triggerWarning(sprintf( @@ -265,7 +265,7 @@ public function addToRequest(RequestInterface $request, array $extraCookies = [] * @param string $scheme The http scheme to match * @param string $host The host to match. * @param string $path The path to match - * @return array An array of cookie name/value pairs + * @return array An array of cookie name/value pairs */ protected function findMatchingCookies(string $scheme, string $host, string $path): array { diff --git a/app/vendor/cakephp/cakephp/src/Http/Cookie/CookieInterface.php b/app/vendor/cakephp/cakephp/src/Http/Cookie/CookieInterface.php index 070ff7c2..dfcdeae1 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Cookie/CookieInterface.php +++ b/app/vendor/cakephp/cakephp/src/Http/Cookie/CookieInterface.php @@ -51,7 +51,7 @@ interface CookieInterface /** * Valid values for "SameSite" attribute. * - * @var string[] + * @var array */ public const SAMESITE_VALUES = [ self::SAMESITE_LAX, @@ -77,7 +77,7 @@ public function getName(): string; /** * Gets the cookie value * - * @return string|array + * @return array|string */ public function getValue(); @@ -93,7 +93,7 @@ public function getScalarValue(); /** * Create a cookie with an updated value. * - * @param string|array $value Value of the cookie to set + * @param array|string $value Value of the cookie to set * @return static */ public function withValue($value); @@ -241,14 +241,14 @@ public function withSameSite(?string $sameSite); /** * Get cookie options * - * @return array + * @return array */ public function getOptions(): array; /** * Get cookie data as array. * - * @return array With keys `name`, `value`, `expires` etc. options. + * @return array With keys `name`, `value`, `expires` etc. options. */ public function toArray(): array; diff --git a/app/vendor/cakephp/cakephp/src/Http/CorsBuilder.php b/app/vendor/cakephp/cakephp/src/Http/CorsBuilder.php index 6d155141..9a69cf8b 100644 --- a/app/vendor/cakephp/cakephp/src/Http/CorsBuilder.php +++ b/app/vendor/cakephp/cakephp/src/Http/CorsBuilder.php @@ -47,7 +47,7 @@ class CorsBuilder protected $_origin; /** - * Whether or not the request was over SSL. + * Whether the request was over SSL. * * @var bool */ @@ -56,7 +56,7 @@ class CorsBuilder /** * The headers that have been queued so far. * - * @var array + * @var array */ protected $_headers = []; @@ -65,7 +65,7 @@ class CorsBuilder * * @param \Psr\Http\Message\MessageInterface $response The response object to add headers onto. * @param string $origin The request's Origin header. - * @param bool $isSsl Whether or not the request was over SSL. + * @param bool $isSsl Whether the request was over SSL. */ public function __construct(MessageInterface $response, string $origin, bool $isSsl = false) { @@ -104,7 +104,7 @@ public function build(): MessageInterface * Accepts a string or an array of domains that have CORS enabled. * You can use `*.example.com` wildcards to accept subdomains, or `*` to allow all domains * - * @param string|string[] $domains The allowed domains + * @param array|string $domains The allowed domains * @return $this */ public function allowOrigin($domains) @@ -125,7 +125,7 @@ public function allowOrigin($domains) /** * Normalize the origin to regular expressions and put in an array format * - * @param string[] $domains Domain names to normalize. + * @param array $domains Domain names to normalize. * @return array */ protected function _normalizeDomains(array $domains): array @@ -151,7 +151,7 @@ protected function _normalizeDomains(array $domains): array /** * Set the list of allowed HTTP Methods. * - * @param string[] $methods The allowed HTTP methods + * @param array $methods The allowed HTTP methods * @return $this */ public function allowMethods(array $methods) @@ -176,7 +176,7 @@ public function allowCredentials() /** * Allowed headers that can be sent in CORS requests. * - * @param string[] $headers The list of headers to accept in CORS requests. + * @param array $headers The list of headers to accept in CORS requests. * @return $this */ public function allowHeaders(array $headers) @@ -189,7 +189,7 @@ public function allowHeaders(array $headers) /** * Define the headers a client library/browser can expose to scripting * - * @param string[] $headers The list of headers to expose CORS responses + * @param array $headers The list of headers to expose CORS responses * @return $this */ public function exposeHeaders(array $headers) @@ -202,7 +202,7 @@ public function exposeHeaders(array $headers) /** * Define the max-age preflight OPTIONS requests are valid for. * - * @param int|string $age The max-age for OPTIONS requests in seconds + * @param string|int $age The max-age for OPTIONS requests in seconds * @return $this */ public function maxAge($age) diff --git a/app/vendor/cakephp/cakephp/src/Http/Exception/HttpException.php b/app/vendor/cakephp/cakephp/src/Http/Exception/HttpException.php index 2f7744ce..0a81d247 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Exception/HttpException.php +++ b/app/vendor/cakephp/cakephp/src/Http/Exception/HttpException.php @@ -17,11 +17,11 @@ use Cake\Core\Exception\CakeException; /** - * Parent class for all of the HTTP related exceptions in CakePHP. + * Parent class for all the HTTP related exceptions in CakePHP. * All HTTP status/error related exceptions should extend this class so * catch blocks can be specifically typed. * - * You may also use this as a meaningful bridge to Cake\Core\Exception\CakeException, e.g.: + * You may also use this as a meaningful bridge to {@link \Cake\Core\Exception\CakeException}, e.g.: * throw new \Cake\Network\Exception\HttpException('HTTP Version Not Supported', 505); */ class HttpException extends CakeException @@ -40,7 +40,7 @@ class HttpException extends CakeException * Set a single HTTP response header. * * @param string $header Header name - * @param string|string[]|null $value Header value + * @param array|string|null $value Header value * @return void */ public function setHeader(string $header, $value = null): void diff --git a/app/vendor/cakephp/cakephp/src/Http/FlashMessage.php b/app/vendor/cakephp/cakephp/src/Http/FlashMessage.php index 2b5270a7..2df3b396 100644 --- a/app/vendor/cakephp/cakephp/src/Http/FlashMessage.php +++ b/app/vendor/cakephp/cakephp/src/Http/FlashMessage.php @@ -30,7 +30,7 @@ class FlashMessage /** * Default configuration * - * @var array + * @var array */ protected $_defaultConfig = [ 'key' => 'flash', @@ -50,7 +50,7 @@ class FlashMessage * Constructor * * @param \Cake\Http\Session $session Session instance. - * @param array $config Config array. + * @param array $config Config array. * @see FlashMessage::set() For list of valid config keys. */ public function __construct(Session $session, array $config = []) @@ -76,7 +76,7 @@ public function __construct(Session $session, array $config = []) * - `escape` Set to false to allow templates to print out HTML content. * * @param string $message Message to be flashed. - * @param array $options An array of options + * @param array $options An array of options * @return void * @see FlashMessage::$_defaultConfig For default values for the options. */ @@ -132,18 +132,14 @@ public function set($message, array $options = []): void * ``` * * @param \Throwable $exception Exception instance. - * @param array $options An array of options. + * @param array $options An array of options. * @return void * @see FlashMessage::set() For list of valid options */ public function setExceptionMessage(Throwable $exception, array $options = []): void { - if (!isset($options['element'])) { - $options['element'] = 'error'; - } - if (!isset($options['params']['code'])) { - $options['params']['code'] = $exception->getCode(); - } + $options['element'] = $options['element'] ?? 'error'; + $options['params']['code'] = $options['params']['code'] ?? $exception->getCode(); $message = $exception->getMessage(); $this->set($message, $options); @@ -166,7 +162,7 @@ public function consume(string $key): ?array * The `'element'` option will be set to `'success'`. * * @param string $message Message to flash. - * @param array $options An array of options. + * @param array $options An array of options. * @return void * @see FlashMessage::set() For list of valid options */ @@ -182,7 +178,7 @@ public function success(string $message, array $options = []): void * The `'element'` option will be set to `'error'`. * * @param string $message Message to flash. - * @param array $options An array of options. + * @param array $options An array of options. * @return void * @see FlashMessage::set() For list of valid options */ @@ -198,7 +194,7 @@ public function error(string $message, array $options = []): void * The `'element'` option will be set to `'warning'`. * * @param string $message Message to flash. - * @param array $options An array of options. + * @param array $options An array of options. * @return void * @see FlashMessage::set() For list of valid options */ @@ -214,7 +210,7 @@ public function warning(string $message, array $options = []): void * The `'element'` option will be set to `'info'`. * * @param string $message Message to flash. - * @param array $options An array of options. + * @param array $options An array of options. * @return void * @see FlashMessage::set() For list of valid options */ diff --git a/app/vendor/cakephp/cakephp/src/Http/Middleware/BodyParserMiddleware.php b/app/vendor/cakephp/cakephp/src/Http/Middleware/BodyParserMiddleware.php index 80dc9842..bd8f0d20 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Middleware/BodyParserMiddleware.php +++ b/app/vendor/cakephp/cakephp/src/Http/Middleware/BodyParserMiddleware.php @@ -28,9 +28,7 @@ /** * Parse encoded request body data. * - * Enables JSON and XML request payloads to be parsed into the request's - * Provides CSRF protection & validation. - * + * Enables JSON and XML request payloads to be parsed into the request's body. * You can also add your own request body parsers using the `addParser()` method. */ class BodyParserMiddleware implements MiddlewareInterface @@ -38,14 +36,14 @@ class BodyParserMiddleware implements MiddlewareInterface /** * Registered Parsers * - * @var \Closure[] + * @var array<\Closure> */ protected $parsers = []; /** * The HTTP methods to parse data on. * - * @var string[] + * @var array */ protected $methods = ['PUT', 'POST', 'PATCH', 'DELETE']; @@ -59,7 +57,7 @@ class BodyParserMiddleware implements MiddlewareInterface * handling requires more care than JSON does. * - `methods` The HTTP methods to parse on. Defaults to PUT, POST, PATCH DELETE. * - * @param array $options The options to use. See above. + * @param array $options The options to use. See above. */ public function __construct(array $options = []) { @@ -84,7 +82,7 @@ public function __construct(array $options = []) /** * Set the HTTP methods to parse request bodies on. * - * @param string[] $methods The methods to parse data on. + * @param array $methods The methods to parse data on. * @return $this */ public function setMethods(array $methods) @@ -97,7 +95,7 @@ public function setMethods(array $methods) /** * Get the HTTP methods to parse request bodies on. * - * @return string[] + * @return array */ public function getMethods(): array { @@ -119,7 +117,7 @@ public function getMethods(): array * }); * ``` * - * @param string[] $types An array of content-type header values to match. eg. application/json + * @param array $types An array of content-type header values to match. eg. application/json * @param \Closure $parser The parser function. Must return an array of data to be inserted * into the request. * @return $this @@ -137,7 +135,7 @@ public function addParser(array $types, Closure $parser) /** * Get the current parsers * - * @return \Closure[] + * @return array<\Closure> */ public function getParsers(): array { diff --git a/app/vendor/cakephp/cakephp/src/Http/Middleware/CspMiddleware.php b/app/vendor/cakephp/cakephp/src/Http/Middleware/CspMiddleware.php index f880bc02..082e4dec 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Middleware/CspMiddleware.php +++ b/app/vendor/cakephp/cakephp/src/Http/Middleware/CspMiddleware.php @@ -17,6 +17,7 @@ namespace Cake\Http\Middleware; +use Cake\Core\InstanceConfigTrait; use ParagonIE\CSPBuilder\CSPBuilder; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; @@ -26,9 +27,16 @@ /** * Content Security Policy Middleware + * + * ### Options + * + * - `scriptNonce` Enable to have a nonce policy added to the script-src directive. + * - `styleNonce` Enable to have a nonce policy added to the style-src directive. */ class CspMiddleware implements MiddlewareInterface { + use InstanceConfigTrait; + /** * CSP Builder * @@ -36,17 +44,29 @@ class CspMiddleware implements MiddlewareInterface */ protected $csp; + /** + * Configuration options. + * + * @var array + */ + protected $_defaultConfig = [ + 'scriptNonce' => false, + 'styleNonce' => false, + ]; + /** * Constructor * * @param \ParagonIE\CSPBuilder\CSPBuilder|array $csp CSP object or config array + * @param array $config Configuration options. * @throws \RuntimeException */ - public function __construct($csp) + public function __construct($csp, array $config = []) { if (!class_exists(CSPBuilder::class)) { throw new RuntimeException('You must install paragonie/csp-builder to use CspMiddleware'); } + $this->setConfig($config); if (!$csp instanceof CSPBuilder) { $csp = new CSPBuilder($csp); @@ -56,7 +76,7 @@ public function __construct($csp) } /** - * Serve assets if the path matches one. + * Add nonces (if enabled) to the request and apply the CSP header to the response. * * @param \Psr\Http\Message\ServerRequestInterface $request The request. * @param \Psr\Http\Server\RequestHandlerInterface $handler The request handler. @@ -64,6 +84,12 @@ public function __construct($csp) */ public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { + if ($this->getConfig('scriptNonce')) { + $request = $request->withAttribute('cspScriptNonce', $this->csp->nonce('script-src')); + } + if ($this->getconfig('styleNonce')) { + $request = $request->withAttribute('cspStyleNonce', $this->csp->nonce('style-src')); + } $response = $handler->handle($request); /** @var \Psr\Http\Message\ResponseInterface */ diff --git a/app/vendor/cakephp/cakephp/src/Http/Middleware/CsrfProtectionMiddleware.php b/app/vendor/cakephp/cakephp/src/Http/Middleware/CsrfProtectionMiddleware.php index 44e8cf0e..28e33bdf 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Middleware/CsrfProtectionMiddleware.php +++ b/app/vendor/cakephp/cakephp/src/Http/Middleware/CsrfProtectionMiddleware.php @@ -23,6 +23,7 @@ use Cake\Http\Response; use Cake\Utility\Hash; use Cake\Utility\Security; +use InvalidArgumentException; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\MiddlewareInterface; @@ -53,15 +54,15 @@ class CsrfProtectionMiddleware implements MiddlewareInterface * - `cookieName` The name of the cookie to send. * - `expiry` A strotime compatible value of how long the CSRF token should last. * Defaults to browser session. - * - `secure` Whether or not the cookie will be set with the Secure flag. Defaults to false. - * - `httponly` Whether or not the cookie will be set with the HttpOnly flag. Defaults to false. + * - `secure` Whether the cookie will be set with the Secure flag. Defaults to false. + * - `httponly` Whether the cookie will be set with the HttpOnly flag. Defaults to false. * - `samesite` "SameSite" attribute for cookies. Defaults to `null`. * Valid values: `CookieInterface::SAMESITE_LAX`, `CookieInterface::SAMESITE_STRICT`, * `CookieInterface::SAMESITE_NONE` or `null`. * - `field` The form field to check. Changing this will also require configuring * FormHelper. * - * @var array + * @var array */ protected $_config = [ 'cookieName' => 'csrfToken', @@ -73,7 +74,7 @@ class CsrfProtectionMiddleware implements MiddlewareInterface ]; /** - * Callback for deciding whether or not to skip the token check for particular request. + * Callback for deciding whether to skip the token check for particular request. * * CSRF protection token check will be skipped if the callback returns `true`. * @@ -102,7 +103,7 @@ class CsrfProtectionMiddleware implements MiddlewareInterface /** * Constructor * - * @param array $config Config options. See $_config for valid keys. + * @param array $config Config options. See $_config for valid keys. */ public function __construct(array $config = []) { @@ -148,8 +149,12 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface $cookies = $request->getCookieParams(); $cookieData = Hash::get($cookies, $this->_config['cookieName']); - if (is_string($cookieData) && strlen($cookieData) > 0) { - $request = $request->withAttribute('csrfToken', $this->saltToken($cookieData)); + if (is_string($cookieData) && $cookieData !== '') { + try { + $request = $request->withAttribute('csrfToken', $this->saltToken($cookieData)); + } catch (InvalidArgumentException $e) { + $cookieData = null; + } } if ($method === 'GET' && $cookieData === null) { @@ -277,6 +282,10 @@ public function saltToken(string $token): string return $token; } $decoded = base64_decode($token, true); + if ($decoded === false) { + throw new InvalidArgumentException('Invalid token data.'); + } + $length = strlen($decoded); $salt = Security::randomBytes($length); $salted = ''; @@ -333,7 +342,7 @@ protected function _verifyToken(string $token): bool } else { $decoded = base64_decode($token, true); } - if (strlen($decoded) <= static::TOKEN_VALUE_LENGTH) { + if (!$decoded || strlen($decoded) <= static::TOKEN_VALUE_LENGTH) { return false; } diff --git a/app/vendor/cakephp/cakephp/src/Http/Middleware/DoublePassDecoratorMiddleware.php b/app/vendor/cakephp/cakephp/src/Http/Middleware/DoublePassDecoratorMiddleware.php index 287d80c5..7bf83d67 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Middleware/DoublePassDecoratorMiddleware.php +++ b/app/vendor/cakephp/cakephp/src/Http/Middleware/DoublePassDecoratorMiddleware.php @@ -38,6 +38,9 @@ * or a class with `__invoke()` method with same signature as above. * * Neither the arguments nor the return value need be typehinted. + * + * @deprecated 4.3.0 "Double pass" middleware are deprecated. + * Use a `Closure` or a class which implements `Psr\Http\Server\MiddlewareInterface` instead. */ class DoublePassDecoratorMiddleware implements MiddlewareInterface { @@ -55,6 +58,11 @@ class DoublePassDecoratorMiddleware implements MiddlewareInterface */ public function __construct(callable $callable) { + deprecationWarning( + '"Double pass" middleware are deprecated. Use a `Closure` with the signature of' + . ' `($request, $handler)` or a class which implements `Psr\Http\Server\MiddlewareInterface` instead.', + 0 + ); $this->callable = $callable; } diff --git a/app/vendor/cakephp/cakephp/src/Http/Middleware/EncryptedCookieMiddleware.php b/app/vendor/cakephp/cakephp/src/Http/Middleware/EncryptedCookieMiddleware.php index 4786cb58..f9e0a4dc 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Middleware/EncryptedCookieMiddleware.php +++ b/app/vendor/cakephp/cakephp/src/Http/Middleware/EncryptedCookieMiddleware.php @@ -32,7 +32,7 @@ * times. * * Cookies in request data will be decrypted, while cookies in response headers will - * be encrypted automatically. If the response is a Cake\Http\Response, the cookie + * be encrypted automatically. If the response is a {@link \Cake\Http\Response}, the cookie * data set with `withCookie()` and `cookie()`` will also be encrypted. * * The encryption types and padding are compatible with those used by CookieComponent @@ -45,7 +45,7 @@ class EncryptedCookieMiddleware implements MiddlewareInterface /** * The list of cookies to encrypt/decrypt * - * @var string[] + * @var array */ protected $cookieNames; @@ -66,7 +66,7 @@ class EncryptedCookieMiddleware implements MiddlewareInterface /** * Constructor * - * @param string[] $cookieNames The list of cookie names that should have their values encrypted. + * @param array $cookieNames The list of cookie names that should have their values encrypted. * @param string $key The encryption key to use. * @param string $cipherType The cipher type to use. Defaults to 'aes'. */ @@ -139,7 +139,7 @@ protected function decodeCookies(ServerRequestInterface $request): ServerRequest */ protected function encodeCookies(Response $response): Response { - /** @var \Cake\Http\Cookie\CookieInterface[] $cookies */ + /** @var array<\Cake\Http\Cookie\CookieInterface> $cookies */ $cookies = $response->getCookieCollection(); foreach ($cookies as $cookie) { if (in_array($cookie->getName(), $this->cookieNames, true)) { @@ -159,7 +159,7 @@ protected function encodeCookies(Response $response): Response */ protected function encodeSetCookieHeader(ResponseInterface $response): ResponseInterface { - /** @var \Cake\Http\Cookie\CookieInterface[] $cookies */ + /** @var array<\Cake\Http\Cookie\CookieInterface> $cookies */ $cookies = CookieCollection::createFromHeader($response->getHeader('Set-Cookie')); $header = []; foreach ($cookies as $cookie) { diff --git a/app/vendor/cakephp/cakephp/src/Http/Middleware/HttpsEnforcerMiddleware.php b/app/vendor/cakephp/cakephp/src/Http/Middleware/HttpsEnforcerMiddleware.php index 491417b2..9176b9a4 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Middleware/HttpsEnforcerMiddleware.php +++ b/app/vendor/cakephp/cakephp/src/Http/Middleware/HttpsEnforcerMiddleware.php @@ -39,8 +39,7 @@ class HttpsEnforcerMiddleware implements MiddlewareInterface * - `headers` - Array of response headers in case of redirect. * - `disableOnDebug` - Whether HTTPS check should be disabled when debug is on. Default `true`. * - * @var array - * @psalm-var array{redirect: bool, statusCode: int, headers: array, disableOnDebug: bool} + * @var array */ protected $config = [ 'redirect' => true, @@ -52,8 +51,8 @@ class HttpsEnforcerMiddleware implements MiddlewareInterface /** * Constructor * - * @param array $config The options to use. - * @see self::$config + * @param array $config The options to use. + * @see \Cake\Http\Middleware\HttpsEnforcerMiddleware::$config */ public function __construct(array $config = []) { @@ -83,6 +82,10 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface if ($this->config['redirect'] && $request->getMethod() === 'GET') { $uri = $request->getUri()->withScheme('https'); + $base = $request->getAttribute('base'); + if ($base) { + $uri = $uri->withPath($base . $uri->getPath()); + } return new RedirectResponse( $uri, diff --git a/app/vendor/cakephp/cakephp/src/Http/Middleware/SecurityHeadersMiddleware.php b/app/vendor/cakephp/cakephp/src/Http/Middleware/SecurityHeadersMiddleware.php index b458522f..f8249b9a 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Middleware/SecurityHeadersMiddleware.php +++ b/app/vendor/cakephp/cakephp/src/Http/Middleware/SecurityHeadersMiddleware.php @@ -164,7 +164,7 @@ public function setReferrerPolicy(string $policy = self::SAME_ORIGIN) * * @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options * @param string $option Option value. Available Values: 'deny', 'sameorigin', 'allow-from ' - * @param string $url URL if mode is `allow-from` + * @param string|null $url URL if mode is `allow-from` * @return $this */ public function setXFrameOptions(string $option = self::SAMEORIGIN, ?string $url = null) @@ -192,8 +192,6 @@ public function setXFrameOptions(string $option = self::SAMEORIGIN, ?string $url */ public function setXssProtection(string $mode = self::XSS_BLOCK) { - $mode = $mode; - if ($mode === self::XSS_BLOCK) { $mode = self::XSS_ENABLED_BLOCK; } @@ -231,7 +229,7 @@ public function setCrossDomainPolicy(string $policy = self::ALL) * * @throws \InvalidArgumentException Thrown when a value is invalid. * @param string $value Value to check - * @param string[] $allowed List of allowed values + * @param array $allowed List of allowed values * @return void */ protected function checkValues(string $value, array $allowed): void diff --git a/app/vendor/cakephp/cakephp/src/Http/Middleware/SessionCsrfProtectionMiddleware.php b/app/vendor/cakephp/cakephp/src/Http/Middleware/SessionCsrfProtectionMiddleware.php index 4b3beae7..b4c0b073 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Middleware/SessionCsrfProtectionMiddleware.php +++ b/app/vendor/cakephp/cakephp/src/Http/Middleware/SessionCsrfProtectionMiddleware.php @@ -54,7 +54,7 @@ class SessionCsrfProtectionMiddleware implements MiddlewareInterface * - `field` The form field to check. Changing this will also require configuring * FormHelper. * - * @var array + * @var array */ protected $_config = [ 'key' => 'csrfToken', @@ -62,7 +62,7 @@ class SessionCsrfProtectionMiddleware implements MiddlewareInterface ]; /** - * Callback for deciding whether or not to skip the token check for particular request. + * Callback for deciding whether to skip the token check for particular request. * * CSRF protection token check will be skipped if the callback returns `true`. * @@ -78,7 +78,7 @@ class SessionCsrfProtectionMiddleware implements MiddlewareInterface /** * Constructor * - * @param array $config Config options. See $_config for valid keys. + * @param array $config Config options. See $_config for valid keys. */ public function __construct(array $config = []) { diff --git a/app/vendor/cakephp/cakephp/src/Http/MiddlewareQueue.php b/app/vendor/cakephp/cakephp/src/Http/MiddlewareQueue.php index ee570418..1069117c 100644 --- a/app/vendor/cakephp/cakephp/src/Http/MiddlewareQueue.php +++ b/app/vendor/cakephp/cakephp/src/Http/MiddlewareQueue.php @@ -46,8 +46,7 @@ class MiddlewareQueue implements Countable, SeekableIterator /** * The queue of middlewares. * - * @var array - * @psalm-var array + * @var array */ protected $queue = []; @@ -64,7 +63,7 @@ public function __construct(array $middleware = []) /** * Resolve middleware name to a PSR 15 compliant middleware instance. * - * @param string|\Closure|\Psr\Http\Server\MiddlewareInterface $middleware The middleware to resolve. + * @param \Psr\Http\Server\MiddlewareInterface|\Closure|string $middleware The middleware to resolve. * @return \Psr\Http\Server\MiddlewareInterface * @throws \RuntimeException If Middleware not found. */ @@ -100,7 +99,7 @@ protected function resolve($middleware): MiddlewareInterface /** * Append a middleware to the end of the queue. * - * @param string|array|\Closure|\Psr\Http\Server\MiddlewareInterface $middleware The middleware(s) to append. + * @param \Psr\Http\Server\MiddlewareInterface|\Closure|array|string $middleware The middleware(s) to append. * @return $this */ public function add($middleware) @@ -118,7 +117,7 @@ public function add($middleware) /** * Alias for MiddlewareQueue::add(). * - * @param string|array|\Closure|\Psr\Http\Server\MiddlewareInterface $middleware The middleware(s) to append. + * @param \Psr\Http\Server\MiddlewareInterface|\Closure|array|string $middleware The middleware(s) to append. * @return $this * @see MiddlewareQueue::add() */ @@ -130,7 +129,7 @@ public function push($middleware) /** * Prepend a middleware to the start of the queue. * - * @param string|array|\Closure|\Psr\Http\Server\MiddlewareInterface $middleware The middleware(s) to prepend. + * @param \Psr\Http\Server\MiddlewareInterface|\Closure|array|string $middleware The middleware(s) to prepend. * @return $this */ public function prepend($middleware) @@ -152,7 +151,7 @@ public function prepend($middleware) * and the existing element will be shifted one index greater. * * @param int $index The index to insert at. - * @param string|\Closure|\Psr\Http\Server\MiddlewareInterface $middleware The middleware to insert. + * @param \Psr\Http\Server\MiddlewareInterface|\Closure|string $middleware The middleware to insert. * @return $this */ public function insertAt(int $index, $middleware) @@ -169,7 +168,7 @@ public function insertAt(int $index, $middleware) * and inserts the supplied middleware before it. * * @param string $class The classname to insert the middleware before. - * @param string|\Closure|\Psr\Http\Server\MiddlewareInterface $middleware The middleware to insert. + * @param \Psr\Http\Server\MiddlewareInterface|\Closure|string $middleware The middleware to insert. * @return $this * @throws \LogicException If middleware to insert before is not found. */ @@ -178,6 +177,7 @@ public function insertBefore(string $class, $middleware) $found = false; $i = 0; foreach ($this->queue as $i => $object) { + /** @psalm-suppress ArgumentTypeCoercion */ if ( ( is_string($object) @@ -203,7 +203,7 @@ public function insertBefore(string $class, $middleware) * this method will behave like add(). * * @param string $class The classname to insert the middleware before. - * @param string|\Closure|\Psr\Http\Server\MiddlewareInterface $middleware The middleware to insert. + * @param \Psr\Http\Server\MiddlewareInterface|\Closure|string $middleware The middleware to insert. * @return $this */ public function insertAfter(string $class, $middleware) @@ -211,6 +211,7 @@ public function insertAfter(string $class, $middleware) $found = false; $i = 0; foreach ($this->queue as $i => $object) { + /** @psalm-suppress ArgumentTypeCoercion */ if ( ( is_string($object) diff --git a/app/vendor/cakephp/cakephp/src/Http/Response.php b/app/vendor/cakephp/cakephp/src/Http/Response.php index 385bdee9..6bf4bea2 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Response.php +++ b/app/vendor/cakephp/cakephp/src/Http/Response.php @@ -56,7 +56,7 @@ class Response implements ResponseInterface /** * Allowed HTTP status codes and their default description. * - * @var string[] + * @var array */ protected $_statusCodes = [ 100 => 'Continue', @@ -129,7 +129,7 @@ class Response implements ResponseInterface /** * Holds type key to mime type mappings for known mime types. * - * @var array + * @var array */ protected $_mimeTypes = [ 'html' => ['text/html', '*/*'], @@ -167,6 +167,7 @@ class Response implements ResponseInterface 'gz' => 'application/x-gzip', 'bz2' => 'application/x-bzip', '7z' => 'application/x-7z-compressed', + 'hal' => ['application/hal+xml', 'application/vnd.hal+xml'], 'haljson' => ['application/hal+json', 'application/vnd.hal+json'], 'halxml' => ['application/hal+xml', 'application/vnd.hal+xml'], 'hdf' => 'application/x-hdf', @@ -178,6 +179,8 @@ class Response implements ResponseInterface 'jsonapi' => 'application/vnd.api+json', 'latex' => 'application/x-latex', 'jsonld' => 'application/ld+json', + 'kml' => 'application/vnd.google-earth.kml+xml', + 'kmz' => 'application/vnd.google-earth.kmz', 'lha' => 'application/octet-stream', 'lsp' => 'application/x-lisp', 'lzh' => 'application/octet-stream', @@ -383,7 +386,7 @@ class Response implements ResponseInterface /** * File range. Used for requesting ranges of files. * - * @var array + * @var array */ protected $_fileRange = []; @@ -426,14 +429,14 @@ class Response implements ResponseInterface /** * Stream target or resource object. * - * @var string|resource + * @var resource|string */ protected $_streamTarget = 'php://memory'; /** * Constructor * - * @param array $options list of parameters to setup the response. Possible values are: + * @param array $options list of parameters to setup the response. Possible values are: * * - body: the response text that should be sent to the client * - status: the HTTP status code to respond with @@ -443,12 +446,8 @@ class Response implements ResponseInterface */ public function __construct(array $options = []) { - if (isset($options['streamTarget'])) { - $this->_streamTarget = $options['streamTarget']; - } - if (isset($options['streamMode'])) { - $this->_streamMode = $options['streamMode']; - } + $this->_streamTarget = $options['streamTarget'] ?? $this->_streamTarget; + $this->_streamMode = $options['streamMode'] ?? $this->_streamMode; if (isset($options['stream'])) { if (!$options['stream'] instanceof StreamInterface) { throw new InvalidArgumentException('Stream option must be an object that implements StreamInterface'); @@ -543,6 +542,7 @@ public function withLocation(string $url) /** * Sets a header. * + * @phpstan-param non-empty-string $header * @param string $header Header key. * @param string $value Header value. * @return void @@ -557,6 +557,7 @@ protected function _setHeader(string $header, string $value): void /** * Clear header * + * @phpstan-param non-empty-string $header * @param string $header Header key. * @return void */ @@ -675,7 +676,7 @@ public function getReasonPhrase(): string * This is needed for RequestHandlerComponent and recognition of types. * * @param string $type Content type. - * @param string|array $mimeType Definition of the mime type. + * @param array|string $mimeType Definition of the mime type. * @return void */ public function setTypeMap(string $type, $mimeType): void @@ -742,15 +743,11 @@ protected function resolveType(string $contentType): string * e.g `getMimeType('pdf'); // returns 'application/pdf'` * * @param string $alias the content type alias to map - * @return string|array|false String mapped mime type or false if $alias is not mapped + * @return array|string|false String mapped mime type or false if $alias is not mapped */ public function getMimeType(string $alias) { - if (isset($this->_mimeTypes[$alias])) { - return $this->_mimeTypes[$alias]; - } - - return false; + return $this->_mimeTypes[$alias] ?? false; } /** @@ -758,8 +755,8 @@ public function getMimeType(string $alias) * * e.g `mapType('application/pdf'); // returns 'pdf'` * - * @param string|array $ctype Either a string content type to map, or an array of types. - * @return string|array|null Aliases for the types provided. + * @param array|string $ctype Either a string content type to map, or an array of types. + * @return array|string|null Aliases for the types provided. */ public function mapType($ctype) { @@ -816,8 +813,8 @@ public function withDisabledCache() /** * Create a new instance with the headers to enable client caching. * - * @param int|string $since a valid time since the response text has not been modified - * @param int|string $time a valid time for cache expiry + * @param string|int $since a valid time since the response text has not been modified + * @param string|int $time a valid time for cache expiry * @return static */ public function withCache($since, $time = '+1 day') @@ -952,7 +949,7 @@ protected function _setCacheControl(): void * $response->withExpires(new DateTime('+1 day')) * ``` * - * @param string|int|\DateTimeInterface|null $time Valid time string or \DateTime instance. + * @param \DateTimeInterface|string|int|null $time Valid time string or \DateTime instance. * @return static */ public function withExpires($time) @@ -975,7 +972,7 @@ public function withExpires($time) * $response->withModified(new DateTime('+1 day')) * ``` * - * @param int|string|\DateTimeInterface $time Valid time string or \DateTime instance. + * @param \DateTimeInterface|string|int $time Valid time string or \DateTime instance. * @return static */ public function withModified($time) @@ -1049,7 +1046,7 @@ public function withNotModified() * separated string. If no parameters are passed, then an * array with the current Vary header value is returned * - * @param string|array $cacheVariances A single Vary string or an array + * @param array|string $cacheVariances A single Vary string or an array * containing the list for variances. * @return static */ @@ -1090,7 +1087,7 @@ public function withEtag(string $hash, bool $weak = false) * Returns a DateTime object initialized at the $time param and using UTC * as timezone * - * @param string|int|\DateTimeInterface|null $time Valid time string or \DateTimeInterface instance. + * @param \DateTimeInterface|string|int|null $time Valid time string or \DateTimeInterface instance. * @return \DateTimeInterface */ protected function _getUTCDate($time = null): DateTimeInterface @@ -1147,7 +1144,7 @@ public function withDownload(string $filename) /** * Create a new response with the Content-Length header set. * - * @param int|string $bytes Number of bytes + * @param string|int $bytes Number of bytes * @return static */ public function withLength($bytes) @@ -1173,7 +1170,7 @@ public function withLength($bytes) * ``` * * @param string $url The LinkHeader url. - * @param array $options The LinkHeader params. + * @param array $options The LinkHeader params. * @return static * @since 3.6.0 */ @@ -1318,7 +1315,7 @@ public function getCookie(string $name): ?array public function getCookies(): array { $out = []; - /** @var \Cake\Http\Cookie\Cookie[] $cookies */ + /** @var array<\Cake\Http\Cookie\Cookie> $cookies */ $cookies = $this->_cookies; foreach ($cookies as $cookie) { $out[$cookie->getName()] = $cookie->toArray(); @@ -1354,36 +1351,6 @@ public function withCookieCollection(CookieCollection $cookieCollection) /** * Get a CorsBuilder instance for defining CORS headers. * - * This method allow multiple ways to setup the domains, see the examples - * - * ### Full URI - * ``` - * cors($request, 'https://www.cakephp.org'); - * ``` - * - * ### URI with wildcard - * ``` - * cors($request, 'https://*.cakephp.org'); - * ``` - * - * ### Ignoring the requested protocol - * ``` - * cors($request, 'www.cakephp.org'); - * ``` - * - * ### Any URI - * ``` - * cors($request, '*'); - * ``` - * - * ### Allowed list of URIs - * ``` - * cors($request, ['http://www.cakephp.org', '*.google.com', 'https://myproject.github.io']); - * ``` - * - * *Note* The `$allowedDomains`, `$allowedMethods`, `$allowedHeaders` parameters are deprecated. - * Instead the builder object should be used. - * * @param \Cake\Http\ServerRequest $request Request object * @return \Cake\Http\CorsBuilder A builder object the provides a fluent interface for defining * additional CORS headers. @@ -1411,7 +1378,7 @@ public function cors(ServerRequest $request): CorsBuilder * be downloaded rather than displayed inline. * * @param string $path Absolute path to file. - * @param array $options Options See above. + * @param array $options Options See above. * @return static * @throws \Cake\Http\Exception\NotFoundException */ @@ -1438,7 +1405,7 @@ public function withFile(string $path, array $options = []) if ($options['download']) { $agent = (string)env('HTTP_USER_AGENT'); - if ($agent && preg_match('%Opera(/| )([0-9].[0-9]{1,2})%', $agent)) { + if ($agent && preg_match('%Opera([/ ])([0-9].[0-9]{1,2})%', $agent)) { $contentType = 'application/octet-stream'; } elseif ($agent && preg_match('/MSIE ([0-9].[0-9]{1,2})/', $agent)) { $contentType = 'application/force-download'; @@ -1468,7 +1435,7 @@ public function withFile(string $path, array $options = []) /** * Convenience method to set a string into the response body * - * @param string $string The string to be sent + * @param string|null $string The string to be sent * @return static */ public function withStringBody(?string $string) @@ -1556,6 +1523,10 @@ protected function _fileRange(SplFileInfo $file, string $httpRange): void $this->_setHeader('Content-Length', (string)($end - $start + 1)); $this->_setHeader('Content-Range', 'bytes ' . $start . '-' . $end . '/' . $fileSize); $this->_setStatus(206); + /** + * @var int $start + * @var int $end + */ $this->_fileRange = [$start, $end]; } @@ -1563,7 +1534,7 @@ protected function _fileRange(SplFileInfo $file, string $httpRange): void * Returns an array that can be used to describe the internal state of this * object. * - * @return array + * @return array */ public function __debugInfo(): array { diff --git a/app/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php b/app/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php index a55a082c..2dac3d4c 100644 --- a/app/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php +++ b/app/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php @@ -209,7 +209,7 @@ protected function emitHeaders(ResponseInterface $response): void /** * Emit cookies using setcookie() * - * @param (string|\Cake\Http\Cookie\CookieInterface)[] $cookies An array of cookies. + * @param array<\Cake\Http\Cookie\CookieInterface|string> $cookies An array of cookies. * @return void */ protected function emitCookies(array $cookies): void @@ -222,7 +222,7 @@ protected function emitCookies(array $cookies): void /** * Helper methods to set cookie. * - * @param string|\Cake\Http\Cookie\CookieInterface $cookie Cookie. + * @param \Cake\Http\Cookie\CookieInterface|string $cookie Cookie. * @return bool */ protected function setCookie($cookie): bool diff --git a/app/vendor/cakephp/cakephp/src/Http/Server.php b/app/vendor/cakephp/cakephp/src/Http/Server.php index 913fbe05..fe90d51f 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Server.php +++ b/app/vendor/cakephp/cakephp/src/Http/Server.php @@ -68,7 +68,7 @@ public function __construct(HttpApplicationInterface $app, ?Runner $runner = nul * - Run the middleware queue including the application. * * @param \Psr\Http\Message\ServerRequestInterface|null $request The request to use or null. - * @param \Cake\Http\MiddlewareQueue $middlewareQueue MiddlewareQueue or null. + * @param \Cake\Http\MiddlewareQueue|null $middlewareQueue MiddlewareQueue or null. * @return \Psr\Http\Message\ResponseInterface * @throws \RuntimeException When the application does not make a response. */ diff --git a/app/vendor/cakephp/cakephp/src/Http/ServerRequest.php b/app/vendor/cakephp/cakephp/src/Http/ServerRequest.php index 2be35282..183d01eb 100644 --- a/app/vendor/cakephp/cakephp/src/Http/ServerRequest.php +++ b/app/vendor/cakephp/cakephp/src/Http/ServerRequest.php @@ -55,7 +55,7 @@ class ServerRequest implements ServerRequestInterface * In PUT/PATCH/DELETE requests this property will contain the form-urlencoded * data. * - * @var array|object|null + * @var object|array|null */ protected $data = []; @@ -95,7 +95,7 @@ class ServerRequest implements ServerRequestInterface protected $webroot = '/'; /** - * Whether or not to trust HTTP_X headers set by most load balancers. + * Whether to trust HTTP_X headers set by most load balancers. * Only set to true if your application runs behind load balancers/proxies * that you control. * @@ -106,7 +106,7 @@ class ServerRequest implements ServerRequestInterface /** * Trusted proxies list * - * @var string[] + * @var array */ protected $trustedProxies = []; @@ -116,7 +116,7 @@ class ServerRequest implements ServerRequestInterface * There are several ways to specify a detector, see \Cake\Http\ServerRequest::addDetector() for the * various formats and ways to define detectors. * - * @var (array|callable)[] + * @var array */ protected static $_detectors = [ 'get' => ['env' => 'REQUEST_METHOD', 'value' => 'GET'], @@ -175,9 +175,9 @@ class ServerRequest implements ServerRequestInterface protected $attributes = []; /** - * A list of propertes that emulated by the PSR7 attribute methods. + * A list of properties that emulated by the PSR7 attribute methods. * - * @var array + * @var array */ protected $emulatedAttributes = ['session', 'flash', 'webroot', 'base', 'params', 'here']; @@ -222,7 +222,7 @@ class ServerRequest implements ServerRequestInterface * requests with put, patch or delete data. * - `session` An instance of a Session object * - * @param array $config An array of request data to create a request with. + * @param array $config An array of request data to create a request with. */ public function __construct(array $config = []) { @@ -246,7 +246,7 @@ public function __construct(array $config = []) /** * Process the config/settings data into properties. * - * @param array $config The config data to use. + * @param array $config The config data to use. * @return void */ protected function _setConfig(array $config): void @@ -303,8 +303,8 @@ protected function _setConfig(array $config): void * * `query` option is also updated based on URL's querystring. * - * @param array $config Config array. - * @return array Update config. + * @param array $config Config array. + * @return array Update config. */ protected function processUrlOption(array $config): array { @@ -397,7 +397,7 @@ public function clientIp(): string /** * register trusted proxies * - * @param string[] $proxies ips list of trusted proxies + * @param array $proxies ips list of trusted proxies * @return void */ public function setTrustedProxies(array $proxies): void @@ -409,7 +409,7 @@ public function setTrustedProxies(array $proxies): void /** * Get trusted proxies * - * @return string[] + * @return array */ public function getTrustedProxies(): array { @@ -431,7 +431,7 @@ public function referer(bool $local = true): ?string if (!empty($ref) && !empty($base)) { if ($local && strpos($ref, $base) === 0) { $ref = substr($ref, strlen($base)); - if (!strlen($ref) || strpos($ref, '//') === 0) { + if ($ref === '' || strpos($ref, '//') === 0) { $ref = '/'; } if ($ref[0] !== '/') { @@ -453,7 +453,7 @@ public function referer(bool $local = true): ?string * * @param string $name The method called * @param array $params Array of parameters for the method call - * @return mixed + * @return bool * @throws \BadMethodCallException when an invalid method is called. */ public function __call(string $name, array $params) @@ -469,16 +469,16 @@ public function __call(string $name, array $params) } /** - * Check whether or not a Request is a certain type. + * Check whether a Request is a certain type. * - * Uses the built in detection rules as well as additional rules - * defined with Cake\Http\ServerRequest::addDetector(). Any detector can be called + * Uses the built-in detection rules as well as additional rules + * defined with {@link \Cake\Http\ServerRequest::addDetector()}. Any detector can be called * as `is($type)` or `is$Type()`. * - * @param string|string[] $type The type of request you want to check. If an array + * @param array|string $type The type of request you want to check. If an array * this method will return true if the request matches any type. * @param mixed ...$args List of arguments - * @return bool Whether or not the request is the type you are checking. + * @return bool Whether the request is the type you are checking. */ public function is($type, ...$args): bool { @@ -499,11 +499,8 @@ public function is($type, ...$args): bool if ($args) { return $this->_is($type, $args); } - if (!isset($this->_detectorCache[$type])) { - $this->_detectorCache[$type] = $this->_is($type, $args); - } - return $this->_detectorCache[$type]; + return $this->_detectorCache[$type] = $this->_detectorCache[$type] ?? $this->_is($type, $args); } /** @@ -521,7 +518,7 @@ public function clearDetectorCache(): void * * @param string $type The type of request you want to check. * @param array $args Array of custom detector arguments. - * @return bool Whether or not the request is the type you are checking. + * @return bool Whether the request is the type you are checking. */ protected function _is(string $type, array $args): bool { @@ -551,7 +548,7 @@ protected function _is(string $type, array $args): bool * Detects if a specific accept header is present. * * @param array $detect Detector options array. - * @return bool Whether or not the request is the type you are checking. + * @return bool Whether the request is the type you are checking. */ protected function _acceptHeaderDetector(array $detect): bool { @@ -569,7 +566,7 @@ protected function _acceptHeaderDetector(array $detect): bool * Detects if a specific header is present. * * @param array $detect Detector options array. - * @return bool Whether or not the request is the type you are checking. + * @return bool Whether the request is the type you are checking. */ protected function _headerDetector(array $detect): bool { @@ -591,7 +588,7 @@ protected function _headerDetector(array $detect): bool * Detects if a specific request parameter is present. * * @param array $detect Detector options array. - * @return bool Whether or not the request is the type you are checking. + * @return bool Whether the request is the type you are checking. */ protected function _paramDetector(array $detect): bool { @@ -612,7 +609,7 @@ protected function _paramDetector(array $detect): bool * Detects if a specific environment variable is present. * * @param array $detect Detector options array. - * @return bool Whether or not the request is the type you are checking. + * @return bool Whether the request is the type you are checking. */ protected function _environmentDetector(array $detect): bool { @@ -640,7 +637,7 @@ protected function _environmentDetector(array $detect): bool * See Request::is() for how to add additional types and the * built-in types. * - * @param string[] $types The types to check. + * @param array $types The types to check. * @return bool Success. * @see \Cake\Http\ServerRequest::is() */ @@ -728,22 +725,22 @@ public function isAll(array $types): bool * `addDetector('extension', ['param' => '_ext', 'options' => ['pdf', 'csv']]` * * @param string $name The name of the detector. - * @param callable|array $callable A callable or options array for the detector definition. + * @param callable|array $detector A callable or options array for the detector definition. * @return void */ - public static function addDetector(string $name, $callable): void + public static function addDetector(string $name, $detector): void { $name = strtolower($name); - if (is_callable($callable)) { - static::$_detectors[$name] = $callable; + if (is_callable($detector)) { + static::$_detectors[$name] = $detector; return; } - if (isset(static::$_detectors[$name], $callable['options'])) { + if (isset(static::$_detectors[$name], $detector['options'])) { /** @psalm-suppress PossiblyInvalidArgument */ - $callable = Hash::merge(static::$_detectors[$name], $callable); + $detector = Hash::merge(static::$_detectors[$name], $detector); } - static::$_detectors[$name] = $callable; + static::$_detectors[$name] = $detector; } /** @@ -771,7 +768,7 @@ protected function normalizeHeaderName(string $name): string * While header names are not case-sensitive, getHeaders() will normalize * the headers. * - * @return string[][] An associative array of headers and their values. + * @return array An associative array of headers and their values. * @link http://www.php-fig.org/psr/psr-7/ This method is part of the PSR-7 server request interface. */ public function getHeaders(): array @@ -799,7 +796,7 @@ public function getHeaders(): array * Check if a header is set in the request. * * @param string $name The header you want to get (case-insensitive) - * @return bool Whether or not the header is defined. + * @return bool Whether the header is defined. * @link http://www.php-fig.org/psr/psr-7/ This method is part of the PSR-7 server request interface. */ public function hasHeader($name): bool @@ -816,7 +813,7 @@ public function hasHeader($name): bool * is not present an empty array will be returned. * * @param string $name The header you want to get (case-insensitive) - * @return string[] An associative array of headers and their values. + * @return array An associative array of headers and their values. * If the header doesn't exist, an empty array will be returned. * @link http://www.php-fig.org/psr/psr-7/ This method is part of the PSR-7 server request interface. */ @@ -848,7 +845,7 @@ public function getHeaderLine($name): string * Get a modified request with the provided header. * * @param string $name The header name. - * @param string|array $value The header value + * @param array|string $value The header value * @return static * @link http://www.php-fig.org/psr/psr-7/ This method is part of the PSR-7 server request interface. */ @@ -868,7 +865,7 @@ public function withHeader($name, $value) * will be appended into the existing values. * * @param string $name The header name. - * @param string|array $value The header value + * @param array|string $value The header value * @return static * @link http://www.php-fig.org/psr/psr-7/ This method is part of the PSR-7 server request interface. */ @@ -1056,7 +1053,7 @@ public function domain(int $tldLength = 1): string * * @param int $tldLength Number of segments your tld contains. For example: `example.com` contains 1 tld. * While `example.co.uk` contains 2. - * @return string[] An array of subdomains. + * @return array An array of subdomains. */ public function subdomains(int $tldLength = 1): array { @@ -1090,7 +1087,7 @@ public function subdomains(int $tldLength = 1): array * by the client. * * @param string|null $type The content type to check for. Leave null to get all types a client accepts. - * @return array|bool Either an array of all the types the client accepts or a boolean if they accept the + * @return array|bool Either an array of all the types the client accepts or a boolean if they accept the * provided type. */ public function accepts(?string $type = null) @@ -1111,10 +1108,10 @@ public function accepts(?string $type = null) * Parse the HTTP_ACCEPT header and return a sorted array with content types * as the keys, and pref values as the values. * - * Generally you want to use Cake\Http\ServerRequest::accept() to get a simple list + * Generally you want to use {@link \Cake\Http\ServerRequest::accepts()} to get a simple list * of the accepted content types. * - * @return array An array of prefValue => [content/types] + * @return array An array of `prefValue => [content/types]` */ public function parseAccept(): array { @@ -1316,8 +1313,8 @@ public function input(?callable $callback = null, ...$args) * Read cookie data from the request's cookie data. * * @param string $key The key or dotted path you want to read. - * @param string|array|null $default The default value if the cookie is not set. - * @return string|array|null Either the cookie value, or null if the value doesn't exist. + * @param array|string|null $default The default value if the cookie is not set. + * @return array|string|null Either the cookie value, or null if the value doesn't exist. */ public function getCookie(string $key, $default = null) { @@ -1395,7 +1392,7 @@ public function withCookieParams(array $cookies) * post data. For other content types, it may be the deserialized request * body. * - * @return array|object|null The deserialized body parameters, if any. + * @return object|array|null The deserialized body parameters, if any. * These will typically be an array. */ public function getParsedBody() @@ -1406,7 +1403,7 @@ public function getParsedBody() /** * Update the parsed body and get a new instance. * - * @param array|object|null $data The deserialized body data. This will + * @param object|array|null $data The deserialized body data. This will * typically be in an array or object. * @return static */ @@ -1511,7 +1508,7 @@ public function withEnv(string $key, string $value) * If the request would be GET, response header "Allow: POST, DELETE" will be set * and a 405 error will be returned. * - * @param string|array $methods Allowed HTTP request methods. + * @param array|string $methods Allowed HTTP request methods. * @return true * @throws \Cake\Http\Exception\MethodNotAllowedException */ @@ -1790,7 +1787,7 @@ public function getUri(): UriInterface * and `url` attributes. * * @param \Psr\Http\Message\UriInterface $uri The new request uri - * @param bool $preserveHost Whether or not the host should be retained. + * @param bool $preserveHost Whether the host should be retained. * @return static */ public function withUri(UriInterface $uri, $preserveHost = false) diff --git a/app/vendor/cakephp/cakephp/src/Http/ServerRequestFactory.php b/app/vendor/cakephp/cakephp/src/Http/ServerRequestFactory.php index 9a39a4cf..4746fb78 100644 --- a/app/vendor/cakephp/cakephp/src/Http/ServerRequestFactory.php +++ b/app/vendor/cakephp/cakephp/src/Http/ServerRequestFactory.php @@ -45,11 +45,11 @@ abstract class ServerRequestFactory implements ServerRequestFactoryInterface * order to marshal the request URI and headers. * * @see fromServer() - * @param array $server $_SERVER superglobal - * @param array $query $_GET superglobal - * @param array $parsedBody $_POST superglobal - * @param array $cookies $_COOKIE superglobal - * @param array $files $_FILES superglobal + * @param array|null $server $_SERVER superglobal + * @param array|null $query $_GET superglobal + * @param array|null $parsedBody $_POST superglobal + * @param array|null $cookies $_COOKIE superglobal + * @param array|null $files $_FILES superglobal * @return \Cake\Http\ServerRequest * @throws \InvalidArgumentException for invalid file values */ @@ -268,7 +268,7 @@ protected static function marshalUriFromSapi(array $server, array $headers): Uri protected static function updatePath(string $base, UriInterface $uri): UriInterface { $path = $uri->getPath(); - if (strlen($base) > 0 && strpos($path, $base) === 0) { + if ($base !== '' && strpos($path, $base) === 0) { $path = substr($path, strlen($base)); } if ($path === '/index.php' && $uri->getQuery()) { diff --git a/app/vendor/cakephp/cakephp/src/Http/Session.php b/app/vendor/cakephp/cakephp/src/Http/Session.php index 99792b9b..2556b691 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Session.php +++ b/app/vendor/cakephp/cakephp/src/Http/Session.php @@ -201,7 +201,7 @@ protected static function _defaultConfig(string $name) * the configuration array for the engine. You can set the `engine` key to an already * instantiated session handler object. * - * @param array $config The Configuration to apply to this session object + * @param array $config The Configuration to apply to this session object */ public function __construct(array $config = []) { @@ -250,8 +250,8 @@ public function __construct(array $config = []) * If no arguments are passed it will return the currently configured handler instance * or null if none exists. * - * @param string|\SessionHandlerInterface|null $class The session handler to use - * @param array $options the options to pass to the SessionHandler constructor + * @param \SessionHandlerInterface|string|null $class The session handler to use + * @param array $options the options to pass to the SessionHandler constructor * @return \SessionHandlerInterface|null * @throws \InvalidArgumentException */ @@ -306,7 +306,7 @@ protected function setEngine(SessionHandlerInterface $handler): SessionHandlerIn * $session->options(['session.use_cookies' => 1]); * ``` * - * @param array $options Ini options to set. + * @param array $options Ini options to set. * @return void * @throws \RuntimeException if any directive could not be set */ @@ -481,6 +481,7 @@ public function consume(string $name) } $value = $this->read($name); if ($value !== null) { + /** @psalm-suppress InvalidScalarArgument */ $this->_overwrite($_SESSION, Hash::remove($_SESSION, $name)); } @@ -490,7 +491,7 @@ public function consume(string $name) /** * Writes value to given session variable name. * - * @param string|array $name Name of variable + * @param array|string $name Name of variable * @param mixed $value Value to write * @return void */ @@ -545,6 +546,7 @@ public function id(?string $id = null): string public function delete(string $name): void { if ($this->check($name)) { + /** @psalm-suppress InvalidScalarArgument */ $this->_overwrite($_SESSION, Hash::remove($_SESSION, $name)); } } @@ -558,13 +560,12 @@ public function delete(string $name): void */ protected function _overwrite(array &$old, array $new): void { - if (!empty($old)) { - foreach ($old as $key => $var) { - if (!isset($new[$key])) { - unset($old[$key]); - } + foreach ($old as $key => $var) { + if (!isset($new[$key])) { + unset($old[$key]); } } + foreach ($new as $key => $var) { $old[$key] = $var; } diff --git a/app/vendor/cakephp/cakephp/src/Http/Session/CacheSession.php b/app/vendor/cakephp/cakephp/src/Http/Session/CacheSession.php index 55790ce1..668ba0e7 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Session/CacheSession.php +++ b/app/vendor/cakephp/cakephp/src/Http/Session/CacheSession.php @@ -39,7 +39,7 @@ class CacheSession implements SessionHandlerInterface /** * Constructor. * - * @param array $config The configuration to use for this engine + * @param array $config The configuration to use for this engine * It requires the key 'config' which is the name of the Cache config to use for * storing the session * @throws \InvalidArgumentException if the 'config' key is not provided @@ -55,11 +55,11 @@ public function __construct(array $config = []) /** * Method called on open of a database session. * - * @param string $savePath The path where to store/retrieve the session. + * @param string $path The path where to store/retrieve the session. * @param string $name The session name. * @return bool Success */ - public function open($savePath, $name): bool + public function open($path, $name): bool { return true; } @@ -78,13 +78,14 @@ public function close(): bool * Method used to read from a cache session. * * @param string $id ID that uniquely identifies session in cache. - * @return string Session data or empty string if it does not exist. + * @return string|false Session data or false if it does not exist. */ - public function read($id): string + #[\ReturnTypeWillChange] + public function read($id) { $value = Cache::read($id, $this->_options['config']); - if (empty($value)) { + if ($value === null) { return ''; } @@ -121,13 +122,14 @@ public function destroy($id): bool } /** - * No-op method. Always returns true since cache engine don't have garbage collection. + * No-op method. Always returns 0 since cache engine don't have garbage collection. * * @param int $maxlifetime Sessions that have not updated for the last maxlifetime seconds will be removed. - * @return bool Always true. + * @return int|false */ - public function gc($maxlifetime): bool + #[\ReturnTypeWillChange] + public function gc($maxlifetime) { - return true; + return 0; } } diff --git a/app/vendor/cakephp/cakephp/src/Http/Session/DatabaseSession.php b/app/vendor/cakephp/cakephp/src/Http/Session/DatabaseSession.php index 5dc76644..76a39a63 100644 --- a/app/vendor/cakephp/cakephp/src/Http/Session/DatabaseSession.php +++ b/app/vendor/cakephp/cakephp/src/Http/Session/DatabaseSession.php @@ -46,7 +46,7 @@ class DatabaseSession implements SessionHandlerInterface * Constructor. Looks at Session configuration information and * sets up the session model. * - * @param array $config The configuration for this engine. It requires the 'model' + * @param array $config The configuration for this engine. It requires the 'model' * key to be present corresponding to the Table to use for managing the sessions. */ public function __construct(array $config = []) @@ -84,11 +84,11 @@ public function setTimeout(int $timeout) /** * Method called on open of a database session. * - * @param string $savePath The path where to store/retrieve the session. + * @param string $path The path where to store/retrieve the session. * @param string $name The session name. * @return bool Success */ - public function open($savePath, $name): bool + public function open($path, $name): bool { return true; } @@ -107,9 +107,10 @@ public function close(): bool * Method used to read from a database session. * * @param string $id ID that uniquely identifies session in database. - * @return string Session data or empty string if it does not exist. + * @return string|false Session data or false if it does not exist. */ - public function read($id): string + #[\ReturnTypeWillChange] + public function read($id) { /** @var string $pkField */ $pkField = $this->_table->getPrimaryKey(); @@ -180,12 +181,11 @@ public function destroy($id): bool * Helper function called on gc for database sessions. * * @param int $maxlifetime Sessions that have not updated for the last maxlifetime seconds will be removed. - * @return bool True on success, false on failure. + * @return int|false The number of deleted sessions on success, or false on failure. */ - public function gc($maxlifetime): bool + #[\ReturnTypeWillChange] + public function gc($maxlifetime) { - $this->_table->deleteAll(['expires <' => time()]); - - return true; + return $this->_table->deleteAll(['expires <' => time()]); } } diff --git a/app/vendor/cakephp/cakephp/src/I18n/ChainMessagesLoader.php b/app/vendor/cakephp/cakephp/src/I18n/ChainMessagesLoader.php index 27ccd6cf..e48c8c3b 100644 --- a/app/vendor/cakephp/cakephp/src/I18n/ChainMessagesLoader.php +++ b/app/vendor/cakephp/cakephp/src/I18n/ChainMessagesLoader.php @@ -27,7 +27,7 @@ class ChainMessagesLoader /** * The list of callables to execute one after another for loading messages * - * @var callable[] + * @var array */ protected $_loaders = []; @@ -35,7 +35,7 @@ class ChainMessagesLoader * Receives a list of callable functions or objects that will be executed * one after another until one of them returns a non-empty translations package * - * @param callable[] $loaders List of callables to execute + * @param array $loaders List of callables to execute */ public function __construct(array $loaders) { diff --git a/app/vendor/cakephp/cakephp/src/I18n/Date.php b/app/vendor/cakephp/cakephp/src/I18n/Date.php index 450018d0..0ba24c7e 100644 --- a/app/vendor/cakephp/cakephp/src/I18n/Date.php +++ b/app/vendor/cakephp/cakephp/src/I18n/Date.php @@ -23,6 +23,8 @@ * Extends the Date class provided by Chronos. * * Adds handy methods and locale-aware formatting helpers + * + * @deprecated 4.3.0 Use the immutable alternative `FrozenDate` instead. */ class Date extends MutableDate implements I18nDateTimeInterface { @@ -40,7 +42,7 @@ class Date extends MutableDate implements I18nDateTimeInterface * will be used for formatting the date part of the object and the second position * will be used to format the time part. * - * @var string|int|int[] + * @var array|string|int * @see \Cake\I18n\DateFormatTrait::i18nFormat() */ protected static $_toStringFormat = [IntlDateFormatter::SHORT, IntlDateFormatter::NONE]; @@ -56,7 +58,7 @@ class Date extends MutableDate implements I18nDateTimeInterface * will be used for formatting the date part of the object and the second position * will be used to format the time part. * - * @var string|int|int[]|\Closure + * @var \Closure|array|string|int * @see \Cake\I18n\Time::i18nFormat() */ protected static $_jsonEncodeFormat = 'yyyy-MM-dd'; @@ -65,7 +67,7 @@ class Date extends MutableDate implements I18nDateTimeInterface * The format to use when formatting a time using `Cake\I18n\Date::timeAgoInWords()` * and the difference is more than `Cake\I18n\Date::$wordEnd` * - * @var string|int|int[] + * @var array|string|int * @see \Cake\I18n\DateFormatTrait::parseDate() */ public static $wordFormat = [IntlDateFormatter::SHORT, IntlDateFormatter::NONE]; @@ -81,7 +83,7 @@ class Date extends MutableDate implements I18nDateTimeInterface * will be used for formatting the date part of the object and the second position * will be used to format the time part. * - * @var string|int|int[] + * @var array|string|int * @see \Cake\I18n\DateFormatTrait::nice() */ public static $niceFormat = [IntlDateFormatter::MEDIUM, IntlDateFormatter::NONE]; @@ -90,7 +92,7 @@ class Date extends MutableDate implements I18nDateTimeInterface * The format to use when formatting a time using `Date::timeAgoInWords()` * and the difference is less than `Date::$wordEnd` * - * @var string[] + * @var array * @see \Cake\I18n\Date::timeAgoInWords() */ public static $wordAccuracy = [ @@ -125,12 +127,17 @@ class Date extends MutableDate implements I18nDateTimeInterface * timezone will always be the server local time. Normalizing the timezone allows for * subtraction/addition to have deterministic results. * - * @param string|int|\DateTime|\DateTimeImmutable|null $time Fixed or relative time + * @param \DateTime|\DateTimeImmutable|string|int|null $time Fixed or relative time * @param \DateTimeZone|string|null $tz The timezone in which the date is taken. * Ignored if `$time` is a DateTimeInterface instance. */ public function __construct($time = 'now', $tz = null) { + deprecationWarning( + 'The `Date` class has been deprecated. Use the immutable alternative `FrozenDate` instead', + 0 + ); + parent::__construct($time, $tz); } @@ -165,7 +172,7 @@ public function __construct($time = 'now', $tz = null) * * NOTE: If the difference is one week or more, the lowest level of accuracy is day. * - * @param array $options Array of options. + * @param array $options Array of options. * @return string Relative time string. */ public function timeAgoInWords(array $options = []): string diff --git a/app/vendor/cakephp/cakephp/src/I18n/DateFormatTrait.php b/app/vendor/cakephp/cakephp/src/I18n/DateFormatTrait.php index 8b13e844..a42d79bb 100644 --- a/app/vendor/cakephp/cakephp/src/I18n/DateFormatTrait.php +++ b/app/vendor/cakephp/cakephp/src/I18n/DateFormatTrait.php @@ -51,7 +51,7 @@ trait DateFormatTrait /** * In-memory cache of date formatters * - * @var \IntlDateFormatter[] + * @var array<\IntlDateFormatter> */ protected static $_formatters = []; @@ -113,7 +113,7 @@ public static function disableLenientParsing(): void * * The format to be used is stored in the static property `Time::niceFormat`. * - * @param string|\DateTimeZone|null $timezone Timezone string or DateTimeZone object + * @param \DateTimeZone|string|null $timezone Timezone string or DateTimeZone object * in which the date will be displayed. The timezone stored for this object will not * be changed. * @param string|null $locale The locale name in which the date should be displayed (e.g. pt-BR) @@ -131,7 +131,7 @@ public function nice($timezone = null, $locale = null): string * It is possible to specify the desired format for the string to be displayed. * You can either pass `IntlDateFormatter` constants as the first argument of this * function, or pass a full ICU date formatting string as specified in the following - * resource: http://www.icu-project.org/apiref/icu4c/classSimpleDateFormat.html#details. + * resource: https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax. * * Additional to `IntlDateFormatter` constants and date formatting string you can use * Time::UNIX_TIMESTAMP_FORMAT to get a unix timestamp @@ -170,8 +170,8 @@ public function nice($timezone = null, $locale = null): string * You can control the default locale used through `Time::setDefaultLocale()`. * If empty, the default will be taken from the `intl.default_locale` ini config. * - * @param string|int|int[]|null $format Format string. - * @param string|\DateTimeZone|null $timezone Timezone string or DateTimeZone object + * @param array|string|int|null $format Format string. + * @param \DateTimeZone|string|null $timezone Timezone string or DateTimeZone object * in which the date will be displayed. The timezone stored for this object will not * be changed. * @param string|null $locale The locale name in which the date should be displayed (e.g. pt-BR) @@ -202,7 +202,7 @@ public function i18nFormat($format = null, $timezone = null, $locale = null) * Implements what IntlDateFormatter::formatObject() is in PHP 5.5+ * * @param \DateTime|\DateTimeImmutable $date Date. - * @param string|int|int[] $format Format. + * @param array|string|int $format Format. * @param string|null $locale The locale name in which the date should be displayed. * @return string */ @@ -293,7 +293,7 @@ public static function resetToStringFormat(): void * will be used for formatting the date part of the object and the second position * will be used to format the time part. * - * @param string|int|int[] $format Format. + * @param array|string|int $format Format. * @return void */ public static function setToStringFormat($format): void @@ -332,7 +332,7 @@ public static function setJsonEncodeFormat($format): void * ``` * * @param string $time The time string to parse. - * @param string|int|int[]|null $format Any format accepted by IntlDateFormatter. + * @param array|string|int|null $format Any format accepted by IntlDateFormatter. * @param \DateTimeZone|string|null $tz The timezone for the instance * @return static|null */ @@ -395,7 +395,7 @@ public static function parseDateTime(string $time, $format = null, $tz = null) * ``` * * @param string $date The date string to parse. - * @param string|int|array|null $format Any format accepted by IntlDateFormatter. + * @param array|string|int|null $format Any format accepted by IntlDateFormatter. * @return static|null */ public static function parseDate(string $date, $format = null) @@ -443,6 +443,7 @@ public static function parseTime(string $time, $format = null) * * @return string|int */ + #[\ReturnTypeWillChange] public function jsonSerialize() { if (static::$_jsonEncodeFormat instanceof Closure) { @@ -481,7 +482,7 @@ public static function setDiffFormatter(DifferenceFormatterInterface $formatter) /** * Returns the data that should be displayed when debugging this object * - * @return array + * @return array */ public function __debugInfo(): array { diff --git a/app/vendor/cakephp/cakephp/src/I18n/FormatterLocator.php b/app/vendor/cakephp/cakephp/src/I18n/FormatterLocator.php index 4a67d022..53631f9c 100644 --- a/app/vendor/cakephp/cakephp/src/I18n/FormatterLocator.php +++ b/app/vendor/cakephp/cakephp/src/I18n/FormatterLocator.php @@ -34,10 +34,10 @@ class FormatterLocator protected $registry = []; /** - * Tracks whether or not a registry entry has been converted from a + * Tracks whether a registry entry has been converted from a * FQCN to a formatter object. * - * @var bool[] + * @var array */ protected $converted = []; diff --git a/app/vendor/cakephp/cakephp/src/I18n/FrozenDate.php b/app/vendor/cakephp/cakephp/src/I18n/FrozenDate.php index a4602bfd..c20fe7f6 100644 --- a/app/vendor/cakephp/cakephp/src/I18n/FrozenDate.php +++ b/app/vendor/cakephp/cakephp/src/I18n/FrozenDate.php @@ -24,7 +24,7 @@ * * Adds handy methods and locale-aware formatting helpers * - * This object provides an immutable variant of Cake\I18n\Date + * This object provides an immutable variant of {@link \Cake\I18n\Date} */ class FrozenDate extends ChronosDate implements I18nDateTimeInterface { @@ -42,7 +42,7 @@ class FrozenDate extends ChronosDate implements I18nDateTimeInterface * will be used for formatting the date part of the object and the second position * will be used to format the time part. * - * @var string|int|int[] + * @var array|string|int * @see \Cake\I18n\DateFormatTrait::i18nFormat() */ protected static $_toStringFormat = [IntlDateFormatter::SHORT, -1]; @@ -58,7 +58,7 @@ class FrozenDate extends ChronosDate implements I18nDateTimeInterface * will be used for formatting the date part of the object and the second position * will be used to format the time part. * - * @var string|int|int[]|\Closure + * @var \Closure|array|string|int * @see \Cake\I18n\Time::i18nFormat() */ protected static $_jsonEncodeFormat = 'yyyy-MM-dd'; @@ -67,7 +67,7 @@ class FrozenDate extends ChronosDate implements I18nDateTimeInterface * The format to use when formatting a time using `Cake\I18n\Date::timeAgoInWords()` * and the difference is more than `Cake\I18n\Date::$wordEnd` * - * @var string|int|int[] + * @var array|string|int * @see \Cake\I18n\DateFormatTrait::parseDate() */ public static $wordFormat = [IntlDateFormatter::SHORT, IntlDateFormatter::NONE]; @@ -83,7 +83,7 @@ class FrozenDate extends ChronosDate implements I18nDateTimeInterface * will be used for formatting the date part of the object and the second position * will be used to format the time part. * - * @var string|int|int[] + * @var array|string|int * @see \Cake\I18n\DateFormatTrait::nice() */ public static $niceFormat = [IntlDateFormatter::MEDIUM, IntlDateFormatter::NONE]; @@ -92,7 +92,7 @@ class FrozenDate extends ChronosDate implements I18nDateTimeInterface * The format to use when formatting a time using `Date::timeAgoInWords()` * and the difference is less than `Date::$wordEnd` * - * @var string[] + * @var array * @see \Cake\I18n\Date::timeAgoInWords() */ public static $wordAccuracy = [ @@ -127,7 +127,7 @@ class FrozenDate extends ChronosDate implements I18nDateTimeInterface * timezone will always be the server local time. Normalizing the timezone allows for * subtraction/addition to have deterministic results. * - * @param string|int|\DateTime|\DateTimeImmutable|null $time Fixed or relative time + * @param \DateTime|\DateTimeImmutable|string|int|null $time Fixed or relative time * @param \DateTimeZone|string|null $tz The timezone in which the date is taken. * Ignored if `$time` is a DateTimeInterface instance. */ @@ -167,7 +167,7 @@ public function __construct($time = 'now', $tz = null) * * NOTE: If the difference is one week or more, the lowest level of accuracy is day. * - * @param array $options Array of options. + * @param array $options Array of options. * @return string Relative time string. */ public function timeAgoInWords(array $options = []): string diff --git a/app/vendor/cakephp/cakephp/src/I18n/FrozenTime.php b/app/vendor/cakephp/cakephp/src/I18n/FrozenTime.php index 2bf669c0..9711bf47 100644 --- a/app/vendor/cakephp/cakephp/src/I18n/FrozenTime.php +++ b/app/vendor/cakephp/cakephp/src/I18n/FrozenTime.php @@ -25,7 +25,7 @@ * Extends the built-in DateTime class to provide handy methods and locale-aware * formatting helpers * - * This object provides an immutable variant of Cake\I18n\Time + * This object provides an immutable variant of {@link \Cake\I18n\Time} */ class FrozenTime extends Chronos implements I18nDateTimeInterface { @@ -43,7 +43,7 @@ class FrozenTime extends Chronos implements I18nDateTimeInterface * will be used for formatting the date part of the object and the second position * will be used to format the time part. * - * @var string|int|int[] + * @var array|string|int * @see \Cake\I18n\FrozenTime::i18nFormat() */ protected static $_toStringFormat = [IntlDateFormatter::SHORT, IntlDateFormatter::SHORT]; @@ -59,7 +59,7 @@ class FrozenTime extends Chronos implements I18nDateTimeInterface * will be used for formatting the date part of the object and the second position * will be used to format the time part. * - * @var string|int|int[]|\Closure + * @var \Closure|array|string|int * @see \Cake\I18n\Time::i18nFormat() */ protected static $_jsonEncodeFormat = "yyyy-MM-dd'T'HH':'mm':'ssxxx"; @@ -75,7 +75,7 @@ class FrozenTime extends Chronos implements I18nDateTimeInterface * will be used for formatting the date part of the object and the second position * will be used to format the time part. * - * @var string|int|int[] + * @var array|string|int * @see \Cake\I18n\FrozenTime::nice() */ public static $niceFormat = [IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT]; @@ -84,7 +84,7 @@ class FrozenTime extends Chronos implements I18nDateTimeInterface * The format to use when formatting a time using `Cake\I18n\FrozenTime::timeAgoInWords()` * and the difference is more than `Cake\I18n\FrozenTime::$wordEnd` * - * @var string|int|int[] + * @var array|string|int * @see \Cake\I18n\FrozenTime::timeAgoInWords() */ public static $wordFormat = [IntlDateFormatter::SHORT, IntlDateFormatter::NONE]; @@ -93,7 +93,7 @@ class FrozenTime extends Chronos implements I18nDateTimeInterface * The format to use when formatting a time using `Time::timeAgoInWords()` * and the difference is less than `Time::$wordEnd` * - * @var string[] + * @var array * @see \Cake\I18n\FrozenTime::timeAgoInWords() */ public static $wordAccuracy = [ @@ -124,7 +124,7 @@ class FrozenTime extends Chronos implements I18nDateTimeInterface /** * Create a new immutable time instance. * - * @param string|int|\DateTimeInterface|null $time Fixed or relative time + * @param \DateTimeInterface|string|int|null $time Fixed or relative time * @param \DateTimeZone|string|null $tz The timezone for the instance */ public function __construct($time = null, $tz = null) @@ -175,7 +175,7 @@ public function __construct($time = null, $tz = null) * * NOTE: If the difference is one week or more, the lowest level of accuracy is day * - * @param array $options Array of options. + * @param array $options Array of options. * @return string Relative time string. */ public function timeAgoInWords(array $options = []): string @@ -187,11 +187,11 @@ public function timeAgoInWords(array $options = []): string /** * Get list of timezone identifiers * - * @param int|string|null $filter A regex to filter identifier + * @param string|int|null $filter A regex to filter identifier * Or one of DateTimeZone class constants * @param string|null $country A two-letter ISO 3166-1 compatible country code. * This option is only used when $filter is set to DateTimeZone::PER_COUNTRY - * @param bool|array $options If true (default value) groups the identifiers list by primary region. + * @param array|bool $options If true (default value) groups the identifiers list by primary region. * Otherwise, an array containing `group`, `abbr`, `before`, and `after` * keys. Setting `group` and `abbr` to true will group results and append * timezone abbreviation in the display value. Set `before` and `after` diff --git a/app/vendor/cakephp/cakephp/src/I18n/I18n.php b/app/vendor/cakephp/cakephp/src/I18n/I18n.php index 2e5c539d..1cf3a559 100644 --- a/app/vendor/cakephp/cakephp/src/I18n/I18n.php +++ b/app/vendor/cakephp/cakephp/src/I18n/I18n.php @@ -53,7 +53,7 @@ class I18n * for getting specific translators based of their name and locale * or to configure some aspect of future translations that are not yet constructed. * - * @return \Cake\I18n\TranslatorRegistry The translators collection. + * @return \Cake\I18n\TranslatorRegistry The translator collection. */ public static function translators(): TranslatorRegistry { @@ -272,7 +272,7 @@ public static function getDefaultFormatter(): string /** * Sets the name of the default messages formatter to use for future - * translator instances. By default the `default` and `sprintf` formatters + * translator instances. By default, the `default` and `sprintf` formatters * are available. * * @param string $name The name of the formatter to use. diff --git a/app/vendor/cakephp/cakephp/src/I18n/I18nDateTimeInterface.php b/app/vendor/cakephp/cakephp/src/I18n/I18nDateTimeInterface.php index 88b5060c..5ccc6b0c 100644 --- a/app/vendor/cakephp/cakephp/src/I18n/I18nDateTimeInterface.php +++ b/app/vendor/cakephp/cakephp/src/I18n/I18nDateTimeInterface.php @@ -45,7 +45,7 @@ public static function setDefaultLocale(?string $locale = null): void; * * The format to be used is stored in the static property `Time::niceFormat`. * - * @param string|\DateTimeZone|null $timezone Timezone string or DateTimeZone object + * @param \DateTimeZone|string|null $timezone Timezone string or DateTimeZone object * in which the date will be displayed. The timezone stored for this object will not * be changed. * @param string|null $locale The locale name in which the date should be displayed (e.g. pt-BR) @@ -103,7 +103,7 @@ public function nice($timezone = null, $locale = null): string; * taken from the `intl.default_locale` ini config. * * @param string|int|null $format Format string. - * @param string|\DateTimeZone|null $timezone Timezone string or DateTimeZone object + * @param \DateTimeZone|string|null $timezone Timezone string or DateTimeZone object * in which the date will be displayed. The timezone stored for this object will not * be changed. * @param string|null $locale The locale name in which the date should be displayed (e.g. pt-BR) @@ -122,7 +122,7 @@ public static function resetToStringFormat(): void; /** * Sets the default format used when type converting instances of this type to string * - * @param string|int|int[] $format Format. + * @param array|string|int $format Format. * @return void */ public static function setToStringFormat($format): void; @@ -142,7 +142,7 @@ public static function setToStringFormat($format): void; * can receive this datetime object and return a formatted string. * * @see \Cake\I18n\Time::i18nFormat() - * @param string|array|int|\Closure $format Format. + * @param \Closure|array|string|int $format Format. * @return void */ public static function setJsonEncodeFormat($format): void; @@ -166,7 +166,7 @@ public static function setJsonEncodeFormat($format): void; * ``` * * @param string $time The time string to parse. - * @param string|int[]|null $format Any format accepted by IntlDateFormatter. + * @param array|string|null $format Any format accepted by IntlDateFormatter. * @param \DateTimeZone|string|null $tz The timezone for the instance * @return static|null * @throws \InvalidArgumentException If $format is a single int instead of array of constants @@ -192,7 +192,7 @@ public static function parseDateTime(string $time, $format = null, $tz = null); * ``` * * @param string $date The date string to parse. - * @param string|int|array|null $format Any format accepted by IntlDateFormatter. + * @param array|string|int|null $format Any format accepted by IntlDateFormatter. * @return static|null */ public static function parseDate(string $date, $format = null); diff --git a/app/vendor/cakephp/cakephp/src/I18n/MessagesFileLoader.php b/app/vendor/cakephp/cakephp/src/I18n/MessagesFileLoader.php index 564077d6..e3993d9f 100644 --- a/app/vendor/cakephp/cakephp/src/I18n/MessagesFileLoader.php +++ b/app/vendor/cakephp/cakephp/src/I18n/MessagesFileLoader.php @@ -146,7 +146,7 @@ public function __invoke() * Returns the folders where the file should be looked for according to the locale * and package name. * - * @return string[] The list of folders where the translation file should be looked for + * @return array The list of folders where the translation file should be looked for */ public function translationsFolders(): array { diff --git a/app/vendor/cakephp/cakephp/src/I18n/Number.php b/app/vendor/cakephp/cakephp/src/I18n/Number.php index 03f53f99..accd550b 100644 --- a/app/vendor/cakephp/cakephp/src/I18n/Number.php +++ b/app/vendor/cakephp/cakephp/src/I18n/Number.php @@ -60,7 +60,7 @@ class Number /** * A list of number formatters indexed by locale and type * - * @var array + * @var array> */ protected static $_formatters = []; @@ -85,9 +85,9 @@ class Number * * - `locale`: The locale name to use for formatting the number, e.g. fr_FR * - * @param float|string $value A floating point number. + * @param string|float $value A floating point number. * @param int $precision The precision of the returned number. - * @param array $options Additional options + * @param array $options Additional options * @return string Formatted float. * @link https://book.cakephp.org/4/en/core-libraries/number.html#formatting-floating-point-numbers */ @@ -95,13 +95,13 @@ public static function precision($value, int $precision = 3, array $options = [] { $formatter = static::formatter(['precision' => $precision, 'places' => $precision] + $options); - return $formatter->format($value); + return $formatter->format((float)$value); } /** * Returns a formatted-for-humans file size. * - * @param int|string $size Size in bytes + * @param string|int $size Size in bytes * @return string Human readable size * @link https://book.cakephp.org/4/en/core-libraries/number.html#interacting-with-human-readable-values */ @@ -131,9 +131,9 @@ public static function toReadableSize($size): string * - `multiply`: Multiply the input value by 100 for decimal percentages. * - `locale`: The locale name to use for formatting the number, e.g. fr_FR * - * @param float|string $value A floating point number + * @param string|float $value A floating point number * @param int $precision The precision of the returned number - * @param array $options Options + * @param array $options Options * @return string Percentage string * @link https://book.cakephp.org/4/en/core-libraries/number.html#formatting-percentages */ @@ -159,8 +159,8 @@ public static function toPercentage($value, int $precision = 2, array $options = * - `before` - The string to place before whole numbers, e.g. '[' * - `after` - The string to place after decimal numbers, e.g. ']' * - * @param float|string $value A floating point number. - * @param array $options An array with options. + * @param string|int|float $value A floating point number. + * @param array $options An array with options. * @return string Formatted number */ public static function format($value, array $options = []): string @@ -181,7 +181,7 @@ public static function format($value, array $options = []): string * numbers representing money. * * @param string $value A numeric string. - * @param array $options An array with options. + * @param array $options An array with options. * @return float point number */ public static function parseFloat(string $value, array $options = []): float @@ -202,8 +202,8 @@ public static function parseFloat(string $value, array $options = []): float * - `before` - The string to place before whole numbers, e.g. '[' * - `after` - The string to place after decimal numbers, e.g. ']' * - * @param float|string $value A floating point number - * @param array $options Options list. + * @param string|float $value A floating point number + * @param array $options Options list. * @return string formatted delta */ public static function formatDelta($value, array $options = []): string @@ -231,12 +231,12 @@ public static function formatDelta($value, array $options = []): string * - `places` - Number of decimal places to use. e.g. 2 * - `precision` - Maximum Number of decimal places to use, e.g. 2 * - `pattern` - An ICU number pattern to use for formatting the number. e.g #,##0.00 - * - `useIntlCode` - Whether or not to replace the currency symbol with the international + * - `useIntlCode` - Whether to replace the currency symbol with the international * currency code. * - * @param float|string $value Value to format. + * @param string|float $value Value to format. * @param string|null $currency International currency name such as 'USD', 'EUR', 'JPY', 'CAD' - * @param array $options Options list. + * @param array $options Options list. * @return string Number formatted as a currency. */ public static function currency($value, ?string $currency = null, array $options = []): string @@ -365,10 +365,10 @@ public static function setDefaultCurrencyFormat($currencyFormat = null): void * - `places` - Number of decimal places to use. e.g. 2 * - `precision` - Maximum Number of decimal places to use, e.g. 2 * - `pattern` - An ICU number pattern to use for formatting the number. e.g #,##0.00 - * - `useIntlCode` - Whether or not to replace the currency symbol with the international + * - `useIntlCode` - Whether to replace the currency symbol with the international * currency code. * - * @param array $options An array with options. + * @param array $options An array with options. * @return \NumberFormatter The configured formatter instance */ public static function formatter(array $options = []): NumberFormatter @@ -423,7 +423,7 @@ public static function formatter(array $options = []): NumberFormatter * * @param string $locale The locale name to use for formatting the number, e.g. fr_FR * @param int $type The formatter type to construct. Defaults to NumberFormatter::DECIMAL. - * @param array $options See Number::formatter() for possible options. + * @param array $options See Number::formatter() for possible options. * @return void */ public static function config(string $locale, int $type = NumberFormatter::DECIMAL, array $options = []): void @@ -438,7 +438,7 @@ public static function config(string $locale, int $type = NumberFormatter::DECIM * Set formatter attributes * * @param \NumberFormatter $formatter Number formatter instance. - * @param array $options See Number::formatter() for possible options. + * @param array $options See Number::formatter() for possible options. * @return \NumberFormatter */ protected static function _setAttributes(NumberFormatter $formatter, array $options = []): NumberFormatter @@ -477,8 +477,8 @@ protected static function _setAttributes(NumberFormatter $formatter, array $opti * * For all other options see formatter(). * - * @param int|float $value An integer - * @param array $options An array with options. + * @param float|int $value An integer + * @param array $options An array with options. * @return string */ public static function ordinal($value, array $options = []): string diff --git a/app/vendor/cakephp/cakephp/src/I18n/Package.php b/app/vendor/cakephp/cakephp/src/I18n/Package.php index 680e13bb..487f2a82 100644 --- a/app/vendor/cakephp/cakephp/src/I18n/Package.php +++ b/app/vendor/cakephp/cakephp/src/I18n/Package.php @@ -25,7 +25,7 @@ class Package /** * Message keys and translations in this package. * - * @var array + * @var array */ protected $messages = []; @@ -49,7 +49,7 @@ class Package * * @param string $formatter The name of the formatter to use. * @param string|null $fallback The name of the fallback package to use. - * @param array $messages The messages in this package. + * @param array $messages The messages in this package. */ public function __construct( string $formatter = 'default', @@ -64,7 +64,7 @@ public function __construct( /** * Sets the messages for this package. * - * @param array $messages The messages for this package. + * @param array $messages The messages for this package. * @return void */ public function setMessages(array $messages): void @@ -76,7 +76,7 @@ public function setMessages(array $messages): void * Adds one message for this package. * * @param string $key the key of the message - * @param string|array $message the actual message + * @param array|string $message the actual message * @return void */ public function addMessage(string $key, $message): void @@ -87,7 +87,7 @@ public function addMessage(string $key, $message): void /** * Adds new messages for this package. * - * @param array $messages The messages to add in this package. + * @param array $messages The messages to add in this package. * @return void */ public function addMessages(array $messages): void @@ -98,7 +98,7 @@ public function addMessages(array $messages): void /** * Gets the messages for this package. * - * @return array + * @return array */ public function getMessages(): array { @@ -109,15 +109,11 @@ public function getMessages(): array * Gets the message of the given key for this package. * * @param string $key the key of the message to return - * @return string|array|false The message translation, or false if not found. + * @return array|string|false The message translation, or false if not found. */ public function getMessage(string $key) { - if (isset($this->messages[$key])) { - return $this->messages[$key]; - } - - return false; + return $this->messages[$key] ?? false; } /** diff --git a/app/vendor/cakephp/cakephp/src/I18n/PackageLocator.php b/app/vendor/cakephp/cakephp/src/I18n/PackageLocator.php index 6cc3f8bc..cbc037cf 100644 --- a/app/vendor/cakephp/cakephp/src/I18n/PackageLocator.php +++ b/app/vendor/cakephp/cakephp/src/I18n/PackageLocator.php @@ -38,7 +38,7 @@ class PackageLocator protected $registry = []; /** - * Tracks whether or not a registry entry has been converted from a + * Tracks whether a registry entry has been converted from a * callable to a Package object. * * @var array @@ -65,7 +65,7 @@ public function __construct(array $registry = []) * * @param string $name The package name. * @param string $locale The locale for the package. - * @param callable|\Cake\I18n\Package $spec A callable that returns a package or Package instance. + * @param \Cake\I18n\Package|callable $spec A callable that returns a package or Package instance. * @return void */ public function set(string $name, string $locale, $spec): void diff --git a/app/vendor/cakephp/cakephp/src/I18n/Parser/MoFileParser.php b/app/vendor/cakephp/cakephp/src/I18n/Parser/MoFileParser.php index 69633363..40696b3e 100644 --- a/app/vendor/cakephp/cakephp/src/I18n/Parser/MoFileParser.php +++ b/app/vendor/cakephp/cakephp/src/I18n/Parser/MoFileParser.php @@ -30,7 +30,7 @@ class MoFileParser * Magic used for validating the format of a MO file as well as * detecting if the machine used to create that file was little endian. * - * @var float + * @var int */ public const MO_LITTLE_ENDIAN_MAGIC = 0x950412de; @@ -38,7 +38,7 @@ class MoFileParser * Magic used for validating the format of a MO file as well as * detecting if the machine used to create that file was big endian. * - * @var float + * @var int */ public const MO_BIG_ENDIAN_MAGIC = 0xde120495; @@ -149,7 +149,7 @@ public function parse($file): array * Reads an unsigned long from stream respecting endianess. * * @param resource $stream The File being read. - * @param bool $isBigEndian Whether or not the current platform is Big Endian + * @param bool $isBigEndian Whether the current platform is Big Endian * @return int */ protected function _readLong($stream, $isBigEndian): int diff --git a/app/vendor/cakephp/cakephp/src/I18n/PluralRules.php b/app/vendor/cakephp/cakephp/src/I18n/PluralRules.php index b52514fe..8de03d69 100644 --- a/app/vendor/cakephp/cakephp/src/I18n/PluralRules.php +++ b/app/vendor/cakephp/cakephp/src/I18n/PluralRules.php @@ -17,10 +17,13 @@ namespace Cake\I18n; use Cake\Core\Exception\CakeException; +use Locale; /** * Utility class used to determine the plural number to be used for a variable - * base on the locale + * base on the locale. + * + * @internal */ class PluralRules { @@ -28,7 +31,7 @@ class PluralRules * A map of locale => plurals group used to determine * which plural rules apply to the language * - * @var array + * @var array */ protected static $_rulesMap = [ 'af' => 1, @@ -103,7 +106,7 @@ class PluralRules 'pap' => 1, 'pl' => 11, 'ps' => 1, - 'pt_pt' => 2, + 'pt_BR' => 2, 'pt' => 1, 'ro' => 12, 'ru' => 3, @@ -140,7 +143,7 @@ class PluralRules */ public static function calculate(string $locale, $n): int { - $locale = strtolower($locale); + $locale = Locale::canonicalize($locale); if (!isset(static::$_rulesMap[$locale])) { $locale = explode('_', $locale)[0]; diff --git a/app/vendor/cakephp/cakephp/src/I18n/RelativeTimeFormatter.php b/app/vendor/cakephp/cakephp/src/I18n/RelativeTimeFormatter.php index 0a1f49f0..ffc18a5b 100644 --- a/app/vendor/cakephp/cakephp/src/I18n/RelativeTimeFormatter.php +++ b/app/vendor/cakephp/cakephp/src/I18n/RelativeTimeFormatter.php @@ -93,7 +93,7 @@ public function diffForHumans( * Format a into a relative timestring. * * @param \Cake\I18n\I18nDateTimeInterface $time The time instance to format. - * @param array $options Array of options. + * @param array $options Array of options. * @return string Relative time string. * @see \Cake\I18n\Time::timeAgoInWords() */ @@ -186,10 +186,10 @@ public function timeAgoInWords(I18nDateTimeInterface $time, array $options = []) /** * Calculate the data needed to format a relative difference string. * - * @param int|string $futureTime The timestamp from the future. - * @param int|string $pastTime The timestamp from the past. - * @param bool $backwards Whether or not the difference was backwards. - * @param array $options An array of options. + * @param string|int $futureTime The timestamp from the future. + * @param string|int $pastTime The timestamp from the past. + * @param bool $backwards Whether the difference was backwards. + * @param array $options An array of options. * @return array An array of values. */ protected function _diffData($futureTime, $pastTime, bool $backwards, $options): array @@ -315,7 +315,7 @@ protected function _diffData($futureTime, $pastTime, bool $backwards, $options): * Format a into a relative date string. * * @param \Cake\I18n\I18nDateTimeInterface $date The date to format. - * @param array $options Array of options. + * @param array $options Array of options. * @return string Relative date string. * @see \Cake\I18n\Date::timeAgoInWords() */ @@ -393,9 +393,9 @@ public function dateAgoInWords(I18nDateTimeInterface $date, array $options = []) /** * Build the options for relative date formatting. * - * @param array $options The options provided by the user. + * @param array $options The options provided by the user. * @param string $class The class name to use for defaults. - * @return array Options with defaults applied. + * @return array Options with defaults applied. * @psalm-param class-string<\Cake\I18n\FrozenDate>|class-string<\Cake\I18n\FrozenTime> $class */ protected function _options(array $options, string $class): array diff --git a/app/vendor/cakephp/cakephp/src/I18n/Time.php b/app/vendor/cakephp/cakephp/src/I18n/Time.php index fdafc256..e82f29a3 100644 --- a/app/vendor/cakephp/cakephp/src/I18n/Time.php +++ b/app/vendor/cakephp/cakephp/src/I18n/Time.php @@ -24,6 +24,8 @@ /** * Extends the built-in DateTime class to provide handy methods and locale-aware * formatting helpers + * + * @deprecated 4.3.0 Use the immutable alternative `FrozenTime` instead. */ class Time extends MutableDateTime implements I18nDateTimeInterface { @@ -41,7 +43,7 @@ class Time extends MutableDateTime implements I18nDateTimeInterface * will be used for formatting the date part of the object and the second position * will be used to format the time part. * - * @var string|int|int[] + * @var array|string|int * @see \Cake\I18n\Time::i18nFormat() */ protected static $_toStringFormat = [IntlDateFormatter::SHORT, IntlDateFormatter::SHORT]; @@ -57,7 +59,7 @@ class Time extends MutableDateTime implements I18nDateTimeInterface * will be used for formatting the date part of the object and the second position * will be used to format the time part. * - * @var string|int|int[]|\Closure + * @var \Closure|array|string|int * @see \Cake\I18n\Time::i18nFormat() */ protected static $_jsonEncodeFormat = "yyyy-MM-dd'T'HH':'mm':'ssxxx"; @@ -73,7 +75,7 @@ class Time extends MutableDateTime implements I18nDateTimeInterface * will be used for formatting the date part of the object and the second position * will be used to format the time part. * - * @var string|int|int[] + * @var array|string|int * @see \Cake\I18n\Time::nice() */ public static $niceFormat = [IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT]; @@ -82,7 +84,7 @@ class Time extends MutableDateTime implements I18nDateTimeInterface * The format to use when formatting a time using `Cake\I18n\Time::timeAgoInWords()` * and the difference is more than `Cake\I18n\Time::$wordEnd` * - * @var string|int|int[] + * @var array|string|int * @see \Cake\I18n\Time::timeAgoInWords() */ public static $wordFormat = [IntlDateFormatter::SHORT, IntlDateFormatter::NONE]; @@ -91,7 +93,7 @@ class Time extends MutableDateTime implements I18nDateTimeInterface * The format to use when formatting a time using `Time::timeAgoInWords()` * and the difference is less than `Time::$wordEnd` * - * @var string[] + * @var array * @see \Cake\I18n\Time::timeAgoInWords() */ public static $wordAccuracy = [ @@ -122,11 +124,16 @@ class Time extends MutableDateTime implements I18nDateTimeInterface /** * Create a new mutable time instance. * - * @param string|int|\DateTimeInterface|null $time Fixed or relative time + * @param \DateTimeInterface|string|int|null $time Fixed or relative time * @param \DateTimeZone|string|null $tz The timezone for the instance */ public function __construct($time = null, $tz = null) { + deprecationWarning( + 'The `Time` class has been deprecated. Use the immutable alternative `FrozenTime` instead', + 0 + ); + if ($time instanceof DateTimeInterface) { $tz = $time->getTimezone(); $time = $time->format('Y-m-d H:i:s.u'); @@ -143,7 +150,7 @@ public function __construct($time = null, $tz = null) * * The format to be used is stored in the static property `Time::niceFormat`. * - * @param string|\DateTimeZone|null $timezone Timezone string or DateTimeZone object + * @param \DateTimeZone|string|null $timezone Timezone string or DateTimeZone object * in which the date will be displayed. The timezone stored for this object will not * be changed. * @param string|null $locale The locale name in which the date should be displayed (e.g. pt-BR) @@ -188,7 +195,7 @@ public function isThisYear(): bool * Returns the quarter * * @param bool $range Range. - * @return string[]|int 1, 2, 3, or 4 quarter of year, or array if $range true + * @return array|int 1, 2, 3, or 4 quarter of year, or array if $range true */ public function toQuarter(bool $range = false) { @@ -255,7 +262,7 @@ public function toUnixString(): string * * NOTE: If the difference is one week or more, the lowest level of accuracy is day * - * @param array $options Array of options. + * @param array $options Array of options. * @return string Relative time string. */ public function timeAgoInWords(array $options = []): string @@ -267,11 +274,11 @@ public function timeAgoInWords(array $options = []): string /** * Get list of timezone identifiers * - * @param int|string|null $filter A regex to filter identifier + * @param string|int|null $filter A regex to filter identifier * Or one of DateTimeZone class constants * @param string|null $country A two-letter ISO 3166-1 compatible country code. * This option is only used when $filter is set to DateTimeZone::PER_COUNTRY - * @param bool|array $options If true (default value) groups the identifiers list by primary region. + * @param array|bool $options If true (default value) groups the identifiers list by primary region. * Otherwise, an array containing `group`, `abbr`, `before`, and `after` * keys. Setting `group` and `abbr` to true will group results and append * timezone abbreviation in the display value. Set `before` and `after` diff --git a/app/vendor/cakephp/cakephp/src/I18n/Translator.php b/app/vendor/cakephp/cakephp/src/I18n/Translator.php index 58f771fb..879591a3 100644 --- a/app/vendor/cakephp/cakephp/src/I18n/Translator.php +++ b/app/vendor/cakephp/cakephp/src/I18n/Translator.php @@ -62,7 +62,7 @@ class Translator * @param string $locale The locale being used. * @param \Cake\I18n\Package $package The Package containing keys and translations. * @param \Cake\I18n\FormatterInterface $formatter A message formatter. - * @param \Cake\I18n\Translator $fallback A fallback translator. + * @param \Cake\I18n\Translator|null $fallback A fallback translator. */ public function __construct( string $locale, @@ -155,7 +155,7 @@ public function translate(string $key, array $tokensValues = []): string $message = $message[$form] ?? (string)end($message); } - if (strlen($message) === 0) { + if ($message === '') { $message = $key; } @@ -170,7 +170,7 @@ public function translate(string $key, array $tokensValues = []): string * @param string $key The message key being handled. * @param array $message The message content. * @param array $vars The variables containing the `_context` key. - * @return string|array + * @return array|string */ protected function resolveContext(string $key, array $message, array $vars) { diff --git a/app/vendor/cakephp/cakephp/src/I18n/TranslatorRegistry.php b/app/vendor/cakephp/cakephp/src/I18n/TranslatorRegistry.php index 181dde02..2895b61e 100644 --- a/app/vendor/cakephp/cakephp/src/I18n/TranslatorRegistry.php +++ b/app/vendor/cakephp/cakephp/src/I18n/TranslatorRegistry.php @@ -32,8 +32,7 @@ class TranslatorRegistry /** * A registry to retain translator objects. * - * @var array - * @psalm-var array> + * @var array> */ protected $registry = []; @@ -64,7 +63,7 @@ class TranslatorRegistry * packages where none can be found for the combination of translator * name and locale. * - * @var callable[] + * @var array */ protected $_loaders = []; @@ -202,6 +201,11 @@ public function get(string $name, ?string $locale = null): ?Translator $keyName = str_replace('/', '.', $name); $key = "translations.{$keyName}.{$locale}"; $translator = $this->_cacher->get($key); + + // PHP <8.1 does not correctly garbage collect strings created + // by unserialized arrays. + gc_collect_cycles(); + if (!$translator || !$translator->getPackage()) { $translator = $this->_getTranslator($name, $locale); $this->_cacher->set($key, $translator); diff --git a/app/vendor/cakephp/cakephp/src/Log/Engine/ArrayLog.php b/app/vendor/cakephp/cakephp/src/Log/Engine/ArrayLog.php index 939b9011..c82e183e 100644 --- a/app/vendor/cakephp/cakephp/src/Log/Engine/ArrayLog.php +++ b/app/vendor/cakephp/cakephp/src/Log/Engine/ArrayLog.php @@ -16,6 +16,8 @@ */ namespace Cake\Log\Engine; +use Cake\Log\Formatter\DefaultFormatter; + /** * Array logger. * @@ -25,6 +27,20 @@ */ class ArrayLog extends BaseLog { + /** + * Default config for this class + * + * @var array + */ + protected $_defaultConfig = [ + 'levels' => [], + 'scopes' => [], + 'formatter' => [ + 'className' => DefaultFormatter::class, + 'includeDate' => false, + ], + ]; + /** * Captured messages * @@ -39,17 +55,18 @@ class ArrayLog extends BaseLog * @param string $message The message you want to log. * @param array $context Additional information about the logged message * @return void success of write. - * @see Cake\Log\Log::$_levels + * @see \Cake\Log\Log::$_levels */ public function log($level, $message, array $context = []) { - $this->content[] = $level . ' ' . $this->_format($message, $context); + $message = $this->_format($message, $context); + $this->content[] = $this->formatter->format($level, $message, $context); } /** * Read the internal storage * - * @return string[] + * @return array */ public function read(): array { diff --git a/app/vendor/cakephp/cakephp/src/Log/Engine/BaseLog.php b/app/vendor/cakephp/cakephp/src/Log/Engine/BaseLog.php index 03edaa0e..b6c3a336 100644 --- a/app/vendor/cakephp/cakephp/src/Log/Engine/BaseLog.php +++ b/app/vendor/cakephp/cakephp/src/Log/Engine/BaseLog.php @@ -18,7 +18,9 @@ use ArrayObject; use Cake\Core\InstanceConfigTrait; -use DateTimeImmutable; +use Cake\Log\Formatter\AbstractFormatter; +use Cake\Log\Formatter\DefaultFormatter; +use InvalidArgumentException; use JsonSerializable; use Psr\Log\AbstractLogger; use Serializable; @@ -33,18 +35,23 @@ abstract class BaseLog extends AbstractLogger /** * Default config for this class * - * @var array + * @var array */ protected $_defaultConfig = [ 'levels' => [], 'scopes' => [], - 'dateFormat' => 'Y-m-d H:i:s', + 'formatter' => DefaultFormatter::class, ]; + /** + * @var \Cake\Log\Formatter\AbstractFormatter + */ + protected $formatter; + /** * __construct method * - * @param array $config Configuration array + * @param array $config Configuration array */ public function __construct(array $config = []) { @@ -61,12 +68,34 @@ public function __construct(array $config = []) if (!empty($this->_config['types']) && empty($this->_config['levels'])) { $this->_config['levels'] = (array)$this->_config['types']; } + + $formatter = $this->_config['formatter'] ?? DefaultFormatter::class; + if (!is_object($formatter)) { + if (is_array($formatter)) { + $class = $formatter['className']; + $options = $formatter; + } else { + $class = $formatter; + $options = []; + } + /** @var class-string<\Cake\Log\Formatter\AbstractFormatter> $class */ + $formatter = new $class($options); + } + + if (!$formatter instanceof AbstractFormatter) { + throw new InvalidArgumentException(sprintf( + 'Formatter must extend `%s`, got `%s` instead', + AbstractFormatter::class, + get_class($formatter) + )); + } + $this->formatter = $formatter; } /** * Get the levels this logger is interested in. * - * @return array + * @return array */ public function levels(): array { @@ -76,7 +105,7 @@ public function levels(): array /** * Get the scopes this logger is interested in. * - * @return array|false + * @return array|false */ public function scopes() { @@ -92,8 +121,21 @@ public function scopes() * @param string $message The message to be formatted. * @param array $context Additional logging information for the message. * @return string + * @deprecated 4.3.0 Call `interpolate()` directly from your log engine and format the message in a formatter. */ protected function _format(string $message, array $context = []): string + { + return $this->interpolate($message, $context); + } + + /** + * Replaces placeholders in message string with context values. + * + * @param string $message Formatted string + * @param array $context Context for placeholder values. + * @return string + */ + protected function interpolate(string $message, array $context = []): string { if (strpos($message, '{') === false && strpos($message, '}') === false) { return $message; @@ -140,13 +182,18 @@ protected function _format(string $message, array $context = []): string } if (is_object($value)) { - if (method_exists($value, '__toString')) { - $replacements['{' . $key . '}'] = (string)$value; + if (method_exists($value, 'toArray')) { + $replacements['{' . $key . '}'] = json_encode($value->toArray(), JSON_UNESCAPED_UNICODE); continue; } - if (method_exists($value, 'toArray')) { - $replacements['{' . $key . '}'] = json_encode($value->toArray(), JSON_UNESCAPED_UNICODE); + if (method_exists($value, '__serialize')) { + $replacements['{' . $key . '}'] = serialize($value); + continue; + } + + if (method_exists($value, '__toString')) { + $replacements['{' . $key . '}'] = (string)$value; continue; } @@ -162,16 +209,4 @@ protected function _format(string $message, array $context = []): string /** @psalm-suppress InvalidArgument */ return str_replace(array_keys($replacements), $replacements, $message); } - - /** - * Returns date formatted according to given `dateFormat` option format. - * - * This function affects `FileLog` or` ConsoleLog` datetime information format. - * - * @return string - */ - protected function _getFormattedDate(): string - { - return (new DateTimeImmutable())->format($this->_config['dateFormat']); - } } diff --git a/app/vendor/cakephp/cakephp/src/Log/Engine/ConsoleLog.php b/app/vendor/cakephp/cakephp/src/Log/Engine/ConsoleLog.php index 76e02ad8..8ec6b8bb 100644 --- a/app/vendor/cakephp/cakephp/src/Log/Engine/ConsoleLog.php +++ b/app/vendor/cakephp/cakephp/src/Log/Engine/ConsoleLog.php @@ -17,6 +17,7 @@ namespace Cake\Log\Engine; use Cake\Console\ConsoleOutput; +use Cake\Log\Formatter\DefaultFormatter; use InvalidArgumentException; /** @@ -27,14 +28,17 @@ class ConsoleLog extends BaseLog /** * Default config for this class * - * @var array + * @var array */ protected $_defaultConfig = [ 'stream' => 'php://stderr', 'levels' => null, 'scopes' => [], 'outputAs' => null, - 'dateFormat' => 'Y-m-d H:i:s', + 'formatter' => [ + 'className' => DefaultFormatter::class, + 'includeTags' => true, + ], ]; /** @@ -55,7 +59,7 @@ class ConsoleLog extends BaseLog * - `outputAs` integer or ConsoleOutput::[RAW|PLAIN|COLOR] * - `dateFormat` PHP date() format. * - * @param array $config Options for the FileLog, see above. + * @param array $config Options for the FileLog, see above. * @throws \InvalidArgumentException */ public function __construct(array $config = []) @@ -74,6 +78,11 @@ public function __construct(array $config = []) if (isset($config['outputAs'])) { $this->_output->setOutputAs($config['outputAs']); } + + if (isset($this->_config['dateFormat'])) { + deprecationWarning('`dateFormat` option should now be set in the formatter options.', 0); + $this->formatter->setConfig('dateFormat', $this->_config['dateFormat']); + } } /** @@ -83,13 +92,11 @@ public function __construct(array $config = []) * @param string $message The message you want to log. * @param array $context Additional information about the logged message * @return void success of write. - * @see Cake\Log\Log::$_levels + * @see \Cake\Log\Log::$_levels */ public function log($level, $message, array $context = []) { $message = $this->_format($message, $context); - $output = $this->_getFormattedDate() . ' ' . ucfirst($level) . ': ' . $message; - - $this->_output->write(sprintf('<%s>%s', $level, $output, $level)); + $this->_output->write($this->formatter->format($level, $message, $context)); } } diff --git a/app/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php b/app/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php index b844a8c8..e208e9ed 100644 --- a/app/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php +++ b/app/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php @@ -17,6 +17,7 @@ namespace Cake\Log\Engine; use Cake\Core\Configure; +use Cake\Log\Formatter\DefaultFormatter; use Cake\Utility\Text; /** @@ -42,7 +43,7 @@ class FileLog extends BaseLog * is made. * - `dateFormat` PHP date() format. * - * @var array + * @var array */ protected $_defaultConfig = [ 'path' => null, @@ -53,7 +54,9 @@ class FileLog extends BaseLog 'rotate' => 10, 'size' => 10485760, // 10MB 'mask' => null, - 'dateFormat' => 'Y-m-d H:i:s', + 'formatter' => [ + 'className' => DefaultFormatter::class, + ], ]; /** @@ -80,7 +83,7 @@ class FileLog extends BaseLog /** * Sets protected properties based on config provided * - * @param array $config Configuration array + * @param array $config Configuration array */ public function __construct(array $config = []) { @@ -105,6 +108,11 @@ public function __construct(array $config = []) $this->_size = Text::parseFileSize($this->_config['size']); } } + + if (isset($this->_config['dateFormat'])) { + deprecationWarning('`dateFormat` option should now be set in the formatter options.', 0); + $this->formatter->setConfig('dateFormat', $this->_config['dateFormat']); + } } /** @@ -114,12 +122,13 @@ public function __construct(array $config = []) * @param string $message The message you want to log. * @param array $context Additional information about the logged message * @return void - * @see Cake\Log\Log::$_levels + * @see \Cake\Log\Log::$_levels */ public function log($level, $message, array $context = []): void { $message = $this->_format($message, $context); - $output = $this->_getFormattedDate() . ' ' . ucfirst($level) . ': ' . $message . "\n"; + $message = $this->formatter->format($level, $message, $context); + $filename = $this->_getFilename($level); if ($this->_size) { $this->_rotateFile($filename); @@ -128,13 +137,13 @@ public function log($level, $message, array $context = []): void $pathname = $this->_path . $filename; $mask = $this->_config['mask']; if (!$mask) { - file_put_contents($pathname, $output, FILE_APPEND); + file_put_contents($pathname, $message . "\n", FILE_APPEND); return; } $exists = is_file($pathname); - file_put_contents($pathname, $output, FILE_APPEND); + file_put_contents($pathname, $message . "\n", FILE_APPEND); static $selfError = false; if (!$selfError && !$exists && !chmod($pathname, (int)$mask)) { diff --git a/app/vendor/cakephp/cakephp/src/Log/Engine/SyslogLog.php b/app/vendor/cakephp/cakephp/src/Log/Engine/SyslogLog.php index 2fc469e2..1e48d0d5 100644 --- a/app/vendor/cakephp/cakephp/src/Log/Engine/SyslogLog.php +++ b/app/vendor/cakephp/cakephp/src/Log/Engine/SyslogLog.php @@ -16,6 +16,9 @@ */ namespace Cake\Log\Engine; +use Cake\Log\Formatter\DefaultFormatter; +use Cake\Log\Formatter\LegacySyslogFormatter; + /** * Syslog stream for Logging. Writes logs to the system logger */ @@ -42,26 +45,28 @@ class SyslogLog extends BaseLog * Log::config('error', ] * 'engine' => 'Syslog', * 'levels' => ['emergency', 'alert', 'critical', 'error'], - * 'format' => "%s: My-App - %s", * 'prefix' => 'Web Server 01' * ]); * ``` * - * @var array + * @var array */ protected $_defaultConfig = [ 'levels' => [], 'scopes' => [], - 'format' => '%s: %s', 'flag' => LOG_ODELAY, 'prefix' => '', 'facility' => LOG_USER, + 'formatter' => [ + 'className' => DefaultFormatter::class, + 'includeDate' => false, + ], ]; /** * Used to map the string names back to their LOG_* constants * - * @var int[] + * @var array */ protected $_levelMap = [ 'emergency' => LOG_EMERG, @@ -81,6 +86,26 @@ class SyslogLog extends BaseLog */ protected $_open = false; + /** + * @inheritDoc + */ + public function __construct(array $config = []) + { + if (isset($config['format'])) { + deprecationWarning( + '`format` option is now deprecated in favor of custom formatters. ' . + 'Switching to `LegacySyslogFormatter`.', + 0 + ); + /** @psalm-suppress DeprecatedClass */ + $config['formatter'] = [ + 'className' => LegacySyslogFormatter::class, + 'format' => $config['format'], + ]; + } + parent::__construct($config); + } + /** * Writes a message to syslog * @@ -91,7 +116,7 @@ class SyslogLog extends BaseLog * @param string $message The message you want to log. * @param array $context Additional information about the logged message * @return void - * @see Cake\Log\Log::$_levels + * @see \Cake\Log\Log::$_levels */ public function log($level, $message, array $context = []): void { @@ -106,10 +131,9 @@ public function log($level, $message, array $context = []): void $priority = $this->_levelMap[$level]; } - $messages = explode("\n", $this->_format($message, $context)); - foreach ($messages as $message) { - $message = sprintf($this->_config['format'], $level, $message); - $this->_write($priority, $message); + $lines = explode("\n", $this->_format($message, $context)); + foreach ($lines as $line) { + $this->_write($priority, $this->formatter->format($level, $line, $context)); } } diff --git a/app/vendor/cakephp/cakephp/src/Log/Log.php b/app/vendor/cakephp/cakephp/src/Log/Log.php index 1d102c30..aa39561b 100644 --- a/app/vendor/cakephp/cakephp/src/Log/Log.php +++ b/app/vendor/cakephp/cakephp/src/Log/Log.php @@ -113,7 +113,7 @@ class Log /** * An array mapping url schemes to fully qualified Log engine class names * - * @var string[] + * @var array * @psalm-var array */ protected static $_dsnClassMap = [ @@ -123,7 +123,7 @@ class Log ]; /** - * Internal flag for tracking whether or not configuration has been changed. + * Internal flag for tracking whether configuration has been changed. * * @var bool */ @@ -139,7 +139,7 @@ class Log /** * Handled log levels * - * @var string[] + * @var array */ protected static $_levels = [ 'emergency', @@ -156,7 +156,7 @@ class Log * Log levels as detailed in RFC 5424 * https://tools.ietf.org/html/rfc5424 * - * @var array + * @var array */ protected static $_levelMap = [ 'emergency' => LOG_EMERG, @@ -176,7 +176,8 @@ class Log */ protected static function _init(): void { - if (empty(static::$_registry)) { + /** @psalm-suppress RedundantPropertyInitializationCheck */ + if (!isset(static::$_registry)) { static::$_registry = new LogEngineRegistry(); } if (static::$_dirtyConfig) { @@ -215,7 +216,8 @@ protected static function _loadConfig(): void */ public static function reset(): void { - if (!empty(static::$_registry)) { + /** @psalm-suppress RedundantPropertyInitializationCheck */ + if (isset(static::$_registry)) { static::$_registry->reset(); } static::$_config = []; @@ -228,7 +230,7 @@ public static function reset(): void * Call this method to obtain current * level configuration. * - * @return string[] Active log levels + * @return array Active log levels */ public static function levels(): array { @@ -270,8 +272,8 @@ public static function levels(): array * Log::setConfig($arrayOfConfig); * ``` * - * @param string|array $key The name of the logger config, or an array of multiple configs. - * @param array|null $config An array of name => config data for adapter. + * @param array|string $key The name of the logger config, or an array of multiple configs. + * @param array|null $config An array of name => config data for adapter. * @return void * @throws \BadMethodCallException When trying to modify an existing config. */ @@ -298,7 +300,7 @@ public static function engine(string $name): ?LoggerInterface } /** - * Writes the given message and type to all of the configured log adapters. + * Writes the given message and type to all the configured log adapters. * Configured adapters are passed both the $level and $message variables. $level * is one of the following strings/values. * @@ -340,14 +342,14 @@ public static function engine(string $name): ?LoggerInterface * then the logged message will be ignored and silently dropped. You can check if this has happened * by inspecting the return of write(). If false the message was not handled. * - * @param int|string $level The severity level of the message being written. + * @param string|int $level The severity level of the message being written. * The value must be an integer or string matching a known level. * @param string $message Message content to log - * @param string|array $context Additional data to be used for logging the message. + * @param array|string $context Additional data to be used for logging the message. * The special `scope` key can be passed to be used for further filtering of the * log engines to be used. If a string or a numerically index array is passed, it * will be treated as the `scope` key. - * See Cake\Log\Log::setConfig() for more information on logging scopes. + * See {@link \Cake\Log\Log::setConfig()} for more information on logging scopes. * @return bool Success * @throws \InvalidArgumentException If invalid level is passed. */ @@ -399,11 +401,11 @@ public static function write($level, string $message, $context = []): bool * Convenience method to log emergency messages * * @param string $message log message - * @param string|array $context Additional data to be used for logging the message. + * @param array|string $context Additional data to be used for logging the message. * The special `scope` key can be passed to be used for further filtering of the * log engines to be used. If a string or a numerically index array is passed, it * will be treated as the `scope` key. - * See Cake\Log\Log::setConfig() for more information on logging scopes. + * See {@link \Cake\Log\Log::setConfig()} for more information on logging scopes. * @return bool Success */ public static function emergency(string $message, $context = []): bool @@ -415,11 +417,11 @@ public static function emergency(string $message, $context = []): bool * Convenience method to log alert messages * * @param string $message log message - * @param string|array $context Additional data to be used for logging the message. + * @param array|string $context Additional data to be used for logging the message. * The special `scope` key can be passed to be used for further filtering of the * log engines to be used. If a string or a numerically index array is passed, it * will be treated as the `scope` key. - * See Cake\Log\Log::setConfig() for more information on logging scopes. + * See {@link \Cake\Log\Log::setConfig()} for more information on logging scopes. * @return bool Success */ public static function alert(string $message, $context = []): bool @@ -431,11 +433,11 @@ public static function alert(string $message, $context = []): bool * Convenience method to log critical messages * * @param string $message log message - * @param string|array $context Additional data to be used for logging the message. + * @param array|string $context Additional data to be used for logging the message. * The special `scope` key can be passed to be used for further filtering of the * log engines to be used. If a string or a numerically index array is passed, it * will be treated as the `scope` key. - * See Cake\Log\Log::setConfig() for more information on logging scopes. + * See {@link \Cake\Log\Log::setConfig()} for more information on logging scopes. * @return bool Success */ public static function critical(string $message, $context = []): bool @@ -447,11 +449,11 @@ public static function critical(string $message, $context = []): bool * Convenience method to log error messages * * @param string $message log message - * @param string|array $context Additional data to be used for logging the message. + * @param array|string $context Additional data to be used for logging the message. * The special `scope` key can be passed to be used for further filtering of the * log engines to be used. If a string or a numerically index array is passed, it * will be treated as the `scope` key. - * See Cake\Log\Log::setConfig() for more information on logging scopes. + * See {@link \Cake\Log\Log::setConfig()} for more information on logging scopes. * @return bool Success */ public static function error(string $message, $context = []): bool @@ -463,11 +465,11 @@ public static function error(string $message, $context = []): bool * Convenience method to log warning messages * * @param string $message log message - * @param string|array $context Additional data to be used for logging the message. + * @param array|string $context Additional data to be used for logging the message. * The special `scope` key can be passed to be used for further filtering of the * log engines to be used. If a string or a numerically index array is passed, it * will be treated as the `scope` key. - * See Cake\Log\Log::setConfig() for more information on logging scopes. + * See {@link \Cake\Log\Log::setConfig()} for more information on logging scopes. * @return bool Success */ public static function warning(string $message, $context = []): bool @@ -479,11 +481,11 @@ public static function warning(string $message, $context = []): bool * Convenience method to log notice messages * * @param string $message log message - * @param string|array $context Additional data to be used for logging the message. + * @param array|string $context Additional data to be used for logging the message. * The special `scope` key can be passed to be used for further filtering of the * log engines to be used. If a string or a numerically index array is passed, it * will be treated as the `scope` key. - * See Cake\Log\Log::setConfig() for more information on logging scopes. + * See {@link \Cake\Log\Log::setConfig()} for more information on logging scopes. * @return bool Success */ public static function notice(string $message, $context = []): bool @@ -495,11 +497,11 @@ public static function notice(string $message, $context = []): bool * Convenience method to log debug messages * * @param string $message log message - * @param string|array $context Additional data to be used for logging the message. + * @param array|string $context Additional data to be used for logging the message. * The special `scope` key can be passed to be used for further filtering of the * log engines to be used. If a string or a numerically index array is passed, it * will be treated as the `scope` key. - * See Cake\Log\Log::setConfig() for more information on logging scopes. + * See {@link \Cake\Log\Log::setConfig()} for more information on logging scopes. * @return bool Success */ public static function debug(string $message, $context = []): bool @@ -511,11 +513,11 @@ public static function debug(string $message, $context = []): bool * Convenience method to log info messages * * @param string $message log message - * @param string|array $context Additional data to be used for logging the message. + * @param array|string $context Additional data to be used for logging the message. * The special `scope` key can be passed to be used for further filtering of the - * log engines to be used. If a string or a numerically index array is passed, it + * log engines to be used. If a string or a numerically indexed array is passed, it * will be treated as the `scope` key. - * See Cake\Log\Log::setConfig() for more information on logging scopes. + * See {@link \Cake\Log\Log::setConfig()} for more information on logging scopes. * @return bool Success */ public static function info(string $message, $context = []): bool diff --git a/app/vendor/cakephp/cakephp/src/Log/LogEngineRegistry.php b/app/vendor/cakephp/cakephp/src/Log/LogEngineRegistry.php index 92fd1ee2..113f6700 100644 --- a/app/vendor/cakephp/cakephp/src/Log/LogEngineRegistry.php +++ b/app/vendor/cakephp/cakephp/src/Log/LogEngineRegistry.php @@ -62,9 +62,9 @@ protected function _throwMissingClassError(string $class, ?string $plugin): void * * Part of the template method for Cake\Core\ObjectRegistry::load() * - * @param string|\Psr\Log\LoggerInterface $class The classname or object to make. + * @param \Psr\Log\LoggerInterface|string $class The classname or object to make. * @param string $alias The alias of the object. - * @param array $config An array of settings to use for the logger. + * @param array $config An array of settings to use for the logger. * @return \Psr\Log\LoggerInterface The constructed logger class. * @throws \RuntimeException when an object doesn't implement the correct interface. */ diff --git a/app/vendor/cakephp/cakephp/src/Log/LogTrait.php b/app/vendor/cakephp/cakephp/src/Log/LogTrait.php index e87b061d..129af882 100644 --- a/app/vendor/cakephp/cakephp/src/Log/LogTrait.php +++ b/app/vendor/cakephp/cakephp/src/Log/LogTrait.php @@ -28,8 +28,8 @@ trait LogTrait * for more information on writing to logs. * * @param string $message Log message. - * @param int|string $level Error level. - * @param string|array $context Additional log data relevant to this message. + * @param string|int $level Error level. + * @param array|string $context Additional log data relevant to this message. * @return bool Success of log write. */ public function log(string $message, $level = LogLevel::ERROR, $context = []): bool diff --git a/app/vendor/cakephp/cakephp/src/Log/composer.json b/app/vendor/cakephp/cakephp/src/Log/composer.json index 0d43640b..81d234e8 100644 --- a/app/vendor/cakephp/cakephp/src/Log/composer.json +++ b/app/vendor/cakephp/cakephp/src/Log/composer.json @@ -25,7 +25,7 @@ "require": { "php": ">=7.2.0", "cakephp/core": "^4.0", - "psr/log": "^1.0.0" + "psr/log": "^1.0 || ^2.0" }, "provide": { "psr/log-implementation": "^1.0.0" diff --git a/app/vendor/cakephp/cakephp/src/Mailer/AbstractTransport.php b/app/vendor/cakephp/cakephp/src/Mailer/AbstractTransport.php index 89786f4d..d469441f 100644 --- a/app/vendor/cakephp/cakephp/src/Mailer/AbstractTransport.php +++ b/app/vendor/cakephp/cakephp/src/Mailer/AbstractTransport.php @@ -29,7 +29,7 @@ abstract class AbstractTransport /** * Default config for this class * - * @var array + * @var array */ protected $_defaultConfig = []; @@ -45,7 +45,7 @@ abstract public function send(Message $message): array; /** * Constructor * - * @param array $config Configuration options. + * @param array $config Configuration options. */ public function __construct(array $config = []) { diff --git a/app/vendor/cakephp/cakephp/src/Mailer/Email.php b/app/vendor/cakephp/cakephp/src/Mailer/Email.php index 0362070e..27323f3c 100644 --- a/app/vendor/cakephp/cakephp/src/Mailer/Email.php +++ b/app/vendor/cakephp/cakephp/src/Mailer/Email.php @@ -115,7 +115,7 @@ class Email implements JsonSerializable, Serializable /** * Constructor * - * @param array|string|null $config Array of configs, or string to load configs from app.php + * @param array|string|null $config Array of configs, or string to load configs from app.php */ public function __construct($config = null) { @@ -233,7 +233,7 @@ public function getViewVars(): array * When setting the transport you can either use the name * of a configured transport or supply a constructed transport. * - * @param string|\Cake\Mailer\AbstractTransport $name Either the name of a configured + * @param \Cake\Mailer\AbstractTransport|string $name Either the name of a configured * transport, or a transport instance. * @return $this * @throws \LogicException When the chosen transport lacks a send method. @@ -274,7 +274,7 @@ public function getTransport(): ?AbstractTransport * Get generated message (used by transport classes) * * @param string|null $type Use MESSAGE_* constants or null to return the full message as array - * @return string|array String if type is given, array if type is null + * @return array|string String if type is given, array if type is null */ public function message(?string $type = null) { @@ -290,7 +290,7 @@ public function message(?string $type = null) /** * Sets the configuration profile to use for this instance. * - * @param string|array $config String with configuration name, or + * @param array|string $config String with configuration name, or * an array with config. * @return $this */ @@ -358,7 +358,7 @@ public function getProfile(): array /** * Send an email using the specified content, template and layout * - * @param string|array|null $content String with message or array with messages + * @param array|string|null $content String with message or array with messages * @return array * @throws \BadMethodCallException * @psalm-return array{headers: string, message: string} @@ -386,7 +386,7 @@ public function send($content = null): array /** * Render email. * - * @param string|array|null $content Content array or string + * @param array|string|null $content Content array or string * @return void */ public function render($content = null): void @@ -471,7 +471,7 @@ protected function _logDelivery(array $contents): void /** * Converts given value to string * - * @param string|array $value The value to convert + * @param array|string $value The value to convert * @return string */ protected function flatten($value): string @@ -482,13 +482,13 @@ protected function flatten($value): string /** * Static method to fast create an instance of \Cake\Mailer\Email * - * @param string|array|null $to Address to send (see Cake\Mailer\Email::to()). + * @param array|string|null $to Address to send ({@see \Cake\Mailer\Email::setTo()}). * If null, will try to use 'to' from transport config * @param string|null $subject String of subject or null to use 'subject' from transport config - * @param string|array|null $message String with message or array with variables to be used in render - * @param string|array $config String to use Email delivery profile from app.php or array with configs + * @param array|string|null $message String with message or array with variables to be used in render + * @param array|string $config String to use Email delivery profile from app.php or array with configs * @param bool $send Send the email or just return the instance pre-configured - * @return \Cake\Mailer\Email Instance of Cake\Mailer\Email + * @return \Cake\Mailer\Email * @throws \InvalidArgumentException */ public static function deliver( @@ -561,8 +561,8 @@ public function jsonSerialize(): array /** * Configures an email instance object from serialized config. * - * @param array $config Email configuration array. - * @return $this Configured email instance. + * @param array $config Email configuration array. + * @return $this */ public function createFromArray(array $config) { @@ -585,6 +585,18 @@ public function createFromArray(array $config) * @return string */ public function serialize(): string + { + $array = $this->__serialize(); + + return serialize($array); + } + + /** + * Magic method used for serializing the Email object. + * + * @return array + */ + public function __serialize(): array { $array = $this->jsonSerialize(); array_walk_recursive($array, function (&$item, $key): void { @@ -593,7 +605,8 @@ public function serialize(): string } }); - return serialize($array); + /** @psalm-var array */ + return $array; } /** @@ -607,6 +620,17 @@ public function unserialize($data): void $this->createFromArray(unserialize($data)); } + /** + * Magic method used to rebuild the Email object. + * + * @param array $data Data array. + * @return void + */ + public function __unserialize(array $data): void + { + $this->createFromArray($data); + } + /** * Proxy all static method calls (for methods provided by StaticConfigTrait) to Mailer. * diff --git a/app/vendor/cakephp/cakephp/src/Mailer/Mailer.php b/app/vendor/cakephp/cakephp/src/Mailer/Mailer.php index efa8d069..9c8e6778 100644 --- a/app/vendor/cakephp/cakephp/src/Mailer/Mailer.php +++ b/app/vendor/cakephp/cakephp/src/Mailer/Mailer.php @@ -21,6 +21,7 @@ use Cake\Event\EventListenerInterface; use Cake\Log\Log; use Cake\Mailer\Exception\MissingActionException; +use Cake\ORM\Locator\LocatorAwareTrait; use Cake\View\ViewBuilder; use InvalidArgumentException; @@ -121,18 +122,19 @@ * @method $this setEmailFormat($format) Sets email format. {@see \Cake\Mailer\Message::getHeaders()} * @method string getEmailFormat() Gets email format. {@see \Cake\Mailer\Message::getEmailFormat()} * @method $this setMessageId($message) Sets message ID. {@see \Cake\Mailer\Message::setMessageId()} - * @method bool|string getMessageId() Gets message ID. {@see \Cake\Mailer\Message::getMessageId()} + * @method string|bool getMessageId() Gets message ID. {@see \Cake\Mailer\Message::getMessageId()} * @method $this setDomain($domain) Sets domain. {@see \Cake\Mailer\Message::setDomain()} * @method string getDomain() Gets domain. {@see \Cake\Mailer\Message::getDomain()} * @method $this setAttachments($attachments) Add attachments to the email message. {@see \Cake\Mailer\Message::setAttachments()} * @method array getAttachments() Gets attachments to the email message. {@see \Cake\Mailer\Message::getAttachments()} * @method $this addAttachments($attachments) Add attachments. {@see \Cake\Mailer\Message::addAttachments()} - * @method string|array getBody(?string $type = null) Get generated message body as array. + * @method array|string getBody(?string $type = null) Get generated message body as array. * {@see \Cake\Mailer\Message::getBody()} */ class Mailer implements EventListenerInterface { use ModelAwareTrait; + use LocatorAwareTrait; use StaticConfigTrait; /** @@ -172,10 +174,10 @@ class Mailer implements EventListenerInterface protected $renderer; /** - * Hold message, renderer and transport instance for restoring after runnning + * Hold message, renderer and transport instance for restoring after running * a mailer action. * - * @var array + * @var array */ protected $clonedInstances = [ 'message' => null, @@ -186,7 +188,7 @@ class Mailer implements EventListenerInterface /** * Mailer driver class map. * - * @var array + * @var array * @psalm-var array */ protected static $_dsnClassMap = []; @@ -199,12 +201,16 @@ class Mailer implements EventListenerInterface /** * Constructor * - * @param array|string|null $config Array of configs, or string to load configs from app.php + * @param array|string|null $config Array of configs, or string to load configs from app.php */ public function __construct($config = null) { $this->message = new $this->messageClass(); + if ($this->defaultTable !== null) { + $this->modelClass = $this->defaultTable; + } + if ($config === null) { $config = static::getConfig('default'); } @@ -294,7 +300,7 @@ public function __call(string $method, array $args) /** * Sets email view vars. * - * @param string|array $key Variable name or hash of view variables. + * @param array|string $key Variable name or hash of view variables. * @param mixed $value View variable value. * @return $this * @deprecated 4.0.0 Use {@link Mailer::setViewVars()} instead. @@ -309,7 +315,7 @@ public function set($key, $value = null) /** * Sets email view vars. * - * @param string|array $key Variable name or hash of view variables. + * @param array|string $key Variable name or hash of view variables. * @param mixed $value View variable value. * @return $this */ @@ -405,7 +411,7 @@ public function deliver(string $content = '') /** * Sets the configuration profile to use for this instance. * - * @param string|array $config String with configuration name, or + * @param array|string $config String with configuration name, or * an array with config. * @return $this */ @@ -468,7 +474,7 @@ public function setProfile($config) * When setting the transport you can either use the name * of a configured transport or supply a constructed transport. * - * @param string|\Cake\Mailer\AbstractTransport $name Either the name of a configured + * @param \Cake\Mailer\AbstractTransport|string $name Either the name of a configured * transport, or a transport instance. * @return $this * @throws \LogicException When the chosen transport lacks a send method. @@ -573,7 +579,7 @@ protected function logDelivery(array $contents): void /** * Set logging config. * - * @param string|array|true $log Log config. + * @param array|string|true $log Log config. * @return void */ protected function setLogConfig($log) @@ -595,7 +601,7 @@ protected function setLogConfig($log) /** * Converts given value to string * - * @param string|array $value The value to convert + * @param array|string $value The value to convert * @return string */ protected function flatten($value): string @@ -606,7 +612,7 @@ protected function flatten($value): string /** * Implemented events. * - * @return array + * @return array */ public function implementedEvents(): array { diff --git a/app/vendor/cakephp/cakephp/src/Mailer/MailerAwareTrait.php b/app/vendor/cakephp/cakephp/src/Mailer/MailerAwareTrait.php index 19b43b5f..dee44ada 100644 --- a/app/vendor/cakephp/cakephp/src/Mailer/MailerAwareTrait.php +++ b/app/vendor/cakephp/cakephp/src/Mailer/MailerAwareTrait.php @@ -32,7 +32,7 @@ trait MailerAwareTrait * Returns a mailer instance. * * @param string $name Mailer's name. - * @param array|string|null $config Array of configs, or profile name string. + * @param array|string|null $config Array of configs, or profile name string. * @return \Cake\Mailer\Mailer * @throws \Cake\Mailer\Exception\MissingMailerException if undefined mailer class. */ diff --git a/app/vendor/cakephp/cakephp/src/Mailer/Message.php b/app/vendor/cakephp/cakephp/src/Mailer/Message.php index 09248ab4..9b51be0e 100644 --- a/app/vendor/cakephp/cakephp/src/Mailer/Message.php +++ b/app/vendor/cakephp/cakephp/src/Mailer/Message.php @@ -147,7 +147,7 @@ class Message implements JsonSerializable, Serializable /** * Message ID * - * @var bool|string + * @var string|bool */ protected $messageId = true; @@ -198,7 +198,7 @@ class Message implements JsonSerializable, Serializable /** * Available formats to be sent. * - * @var array + * @var array */ protected $emailFormatAvailable = [self::MESSAGE_TEXT, self::MESSAGE_HTML, self::MESSAGE_BOTH]; @@ -235,7 +235,7 @@ class Message implements JsonSerializable, Serializable /** * Available encoding to be set for transfer. * - * @var array + * @var array */ protected $transferEncodingAvailable = [ '7bit', @@ -257,7 +257,7 @@ class Message implements JsonSerializable, Serializable * * Only absolute paths * - * @var array + * @var array */ protected $attachments = []; @@ -278,14 +278,14 @@ class Message implements JsonSerializable, Serializable /** * 8Bit character sets * - * @var array + * @var array */ protected $charset8bit = ['UTF-8', 'SHIFT_JIS']; /** * Define Content-Type charset name * - * @var array + * @var array */ protected $contentTypeCharset = [ 'ISO-2022-JP-MS' => 'ISO-2022-JP', @@ -304,7 +304,7 @@ class Message implements JsonSerializable, Serializable /** * Constructor * - * @param array|null $config Array of configs, or string to load configs from app.php + * @param array|null $config Array of configs, or string to load configs from app.php */ public function __construct(?array $config = null) { @@ -325,7 +325,7 @@ public function __construct(?array $config = null) /** * Sets "from" address. * - * @param string|array $email String with email, + * @param array|string $email String with email, * Array with email as key, name as value or email as value (without name) * @param string|null $name Name * @return $this @@ -349,7 +349,7 @@ public function getFrom(): array /** * Sets the "sender" address. See RFC link below for full explanation. * - * @param string|array $email String with email, + * @param array|string $email String with email, * Array with email as key, name as value or email as value (without name) * @param string|null $name Name * @return $this @@ -375,7 +375,7 @@ public function getSender(): array /** * Sets "Reply-To" address. * - * @param string|array $email String with email, + * @param array|string $email String with email, * Array with email as key, name as value or email as value (without name) * @param string|null $name Name * @return $this @@ -399,7 +399,7 @@ public function getReplyTo(): array /** * Add "Reply-To" address. * - * @param string|array $email String with email, + * @param array|string $email String with email, * Array with email as key, name as value or email as value (without name) * @param string|null $name Name * @return $this @@ -412,7 +412,7 @@ public function addReplyTo($email, ?string $name = null) /** * Sets Read Receipt (Disposition-Notification-To header). * - * @param string|array $email String with email, + * @param array|string $email String with email, * Array with email as key, name as value or email as value (without name) * @param string|null $name Name * @return $this @@ -441,7 +441,7 @@ public function getReadReceipt(): array /** * Sets return path. * - * @param string|array $email String with email, + * @param array|string $email String with email, * Array with email as key, name as value or email as value (without name) * @param string|null $name Name * @return $this @@ -465,7 +465,7 @@ public function getReturnPath(): array /** * Sets "to" address. * - * @param string|array $email String with email, + * @param array|string $email String with email, * Array with email as key, name as value or email as value (without name) * @param string|null $name Name * @return $this @@ -488,7 +488,7 @@ public function getTo(): array /** * Add "To" address. * - * @param string|array $email String with email, + * @param array|string $email String with email, * Array with email as key, name as value or email as value (without name) * @param string|null $name Name * @return $this @@ -501,7 +501,7 @@ public function addTo($email, ?string $name = null) /** * Sets "cc" address. * - * @param string|array $email String with email, + * @param array|string $email String with email, * Array with email as key, name as value or email as value (without name) * @param string|null $name Name * @return $this @@ -524,7 +524,7 @@ public function getCc(): array /** * Add "cc" address. * - * @param string|array $email String with email, + * @param array|string $email String with email, * Array with email as key, name as value or email as value (without name) * @param string|null $name Name * @return $this @@ -537,7 +537,7 @@ public function addCc($email, ?string $name = null) /** * Sets "bcc" address. * - * @param string|array $email String with email, + * @param array|string $email String with email, * Array with email as key, name as value or email as value (without name) * @param string|null $name Name * @return $this @@ -560,7 +560,7 @@ public function getBcc(): array /** * Add "bcc" address. * - * @param string|array $email String with email, + * @param array|string $email String with email, * Array with email as key, name as value or email as value (without name) * @param string|null $name Name * @return $this @@ -680,7 +680,7 @@ public function getEmailPattern(): ?string * Set email * * @param string $varName Property name - * @param string|array $email String with email, + * @param array|string $email String with email, * Array with email as key, name as value or email as value (without name) * @param string|null $name Name * @return $this @@ -736,7 +736,7 @@ protected function validateEmail(string $email, string $context): void * Set only 1 email * * @param string $varName Property name - * @param string|array $email String with email, + * @param array|string $email String with email, * Array with email as key, name as value or email as value (without name) * @param string|null $name Name * @param string $throwMessage Exception message @@ -765,7 +765,7 @@ protected function setEmailSingle(string $varName, $email, ?string $name, string * Add email * * @param string $varName Property name - * @param string|array $email String with email, + * @param array|string $email String with email, * Array with email as key, name as value or email as value (without name) * @param string|null $name Name * @return $this @@ -868,8 +868,8 @@ public function addHeaders(array $headers) * - `bcc` * - `subject` * - * @param string[] $include List of headers. - * @return string[] + * @param array $include List of headers. + * @return array */ public function getHeaders(array $include = []): array { @@ -953,9 +953,9 @@ public function getHeaders(array $include = []): array /** * Get headers as string. * - * @param string[] $include List of headers. + * @param array $include List of headers. * @param string $eol End of line string for concatenating headers. - * @param \Closure $callback Callback to run each header value through before stringifying. + * @param \Closure|null $callback Callback to run each header value through before stringifying. * @return string * @see Message::getHeaders() */ @@ -1055,7 +1055,7 @@ public function getBodyTypes(): array /** * Sets message ID. * - * @param bool|string $message True to generate a new Message-ID, False to ignore (not send in email), + * @param string|bool $message True to generate a new Message-ID, False to ignore (not send in email), * String to set as Message-ID. * @return $this * @throws \InvalidArgumentException @@ -1079,7 +1079,7 @@ public function setMessageId($message) /** * Gets message ID. * - * @return bool|string + * @return string|bool */ public function getMessageId() { @@ -1217,7 +1217,7 @@ public function setAttachments(array $attachments) /** * Gets attachments to the email message. * - * @return array Array of attachments. + * @return array Array of attachments. */ public function getAttachments(): array { @@ -1290,7 +1290,7 @@ protected function createBoundary(): void /** * Generate full message. * - * @return string[] + * @return array */ protected function generateMessage(): array { @@ -1383,7 +1383,7 @@ protected function generateMessage(): array * Attach non-embedded files by adding file contents inside boundaries. * * @param string|null $boundary Boundary to use. If null, will default to $this->boundary - * @return string[] An array of lines to add to the message + * @return array An array of lines to add to the message */ protected function attachFiles(?string $boundary = null): array { @@ -1423,7 +1423,7 @@ protected function attachFiles(?string $boundary = null): array * Attach inline/embedded files to the message. * * @param string|null $boundary Boundary to use. If null, will default to $this->boundary - * @return string[] An array of lines to add to the message + * @return array An array of lines to add to the message */ protected function attachInlineFiles(?string $boundary = null): array { @@ -1478,7 +1478,7 @@ public function getPriority(): ?int /** * Sets the configuration for this instance. * - * @param array $config Config array. + * @param array $config Config array. * @return $this */ public function setConfig(array $config) @@ -1504,7 +1504,7 @@ public function setConfig(array $config) /** * Set message body. * - * @param array $content Content array with keys "text" and/or "html" with + * @param array $content Content array with keys "text" and/or "html" with * content string of respective type. * @return $this */ @@ -1606,11 +1606,11 @@ protected function encodeString(string $text, string $charset): string * * @param string|null $message Message to wrap * @param int $wrapLength The line length - * @return array Wrapped message + * @return array Wrapped message */ protected function wrap(?string $message = null, int $wrapLength = self::LINE_LENGTH_MUST): array { - if ($message === null || strlen($message) === 0) { + if ($message === null || $message === '') { return ['']; } $message = str_replace(["\r\n", "\r"], "\n", $message); @@ -1787,7 +1787,7 @@ protected function decodeForHeader(string $text): string /** * Read the file contents and return a base64 version of the file contents. * - * @param string|\Psr\Http\Message\UploadedFileInterface $file The absolute path to the file to read + * @param \Psr\Http\Message\UploadedFileInterface|string $file The absolute path to the file to read * or UploadedFileInterface instance. * @return string File contents in base64 encoding */ @@ -1876,8 +1876,8 @@ public function jsonSerialize(): array /** * Configures an email instance object from serialized config. * - * @param array $config Email configuration array. - * @return $this Configured email instance. + * @param array $config Email configuration array. + * @return $this */ public function createFromArray(array $config) { @@ -1894,6 +1894,18 @@ public function createFromArray(array $config) * @return string */ public function serialize(): string + { + $array = $this->__serialize(); + + return serialize($array); + } + + /** + * Magic method used for serializing the Message object. + * + * @return array + */ + public function __serialize(): array { $array = $this->jsonSerialize(); array_walk_recursive($array, function (&$item, $key): void { @@ -1902,7 +1914,8 @@ public function serialize(): string } }); - return serialize($array); + /** @psalm-var array */ + return $array; } /** @@ -1920,4 +1933,15 @@ public function unserialize($data) $this->createFromArray($array); } + + /** + * Magic method used to rebuild the Message object. + * + * @param array $data Data array. + * @return void + */ + public function __unserialize(array $data): void + { + $this->createFromArray($data); + } } diff --git a/app/vendor/cakephp/cakephp/src/Mailer/Renderer.php b/app/vendor/cakephp/cakephp/src/Mailer/Renderer.php index 118b41f7..2c394309 100644 --- a/app/vendor/cakephp/cakephp/src/Mailer/Renderer.php +++ b/app/vendor/cakephp/cakephp/src/Mailer/Renderer.php @@ -48,9 +48,9 @@ public function __construct() * of the specified content types for the email. * * @param string $content The content. - * @param string[] $types Content types to render. Valid array values are Message::MESSAGE_HTML, Message::MESSAGE_TEXT. - * @return array The rendered content with "html" and/or "text" keys. - * @psalm-param (\Cake\Mailer\Message::MESSAGE_HTML|\Cake\Mailer\Message::MESSAGE_TEXT)[] $types + * @param array $types Content types to render. Valid array values are Message::MESSAGE_HTML, Message::MESSAGE_TEXT. + * @return array The rendered content with "html" and/or "text" keys. + * @psalm-param array<\Cake\Mailer\Message::MESSAGE_HTML|\Cake\Mailer\Message::MESSAGE_TEXT> $types * @psalm-return array{html?: string, text?: string} */ public function render(string $content, array $types = []): array diff --git a/app/vendor/cakephp/cakephp/src/Mailer/Transport/SmtpTransport.php b/app/vendor/cakephp/cakephp/src/Mailer/Transport/SmtpTransport.php index 2ea6dcd7..86323606 100644 --- a/app/vendor/cakephp/cakephp/src/Mailer/Transport/SmtpTransport.php +++ b/app/vendor/cakephp/cakephp/src/Mailer/Transport/SmtpTransport.php @@ -21,6 +21,7 @@ use Cake\Network\Exception\SocketException; use Cake\Network\Socket; use Exception; +use RuntimeException; /** * Send mail using SMTP protocol @@ -30,7 +31,7 @@ class SmtpTransport extends AbstractTransport /** * Default config for this class * - * @var array + * @var array */ protected $_defaultConfig = [ 'host' => 'localhost', @@ -114,7 +115,7 @@ public function connect(): void */ public function connected(): bool { - return $this->_socket !== null && $this->_socket->connected; + return $this->_socket !== null && $this->_socket->isConnected(); } /** @@ -196,7 +197,7 @@ public function send(Message $message): array /** * Parses and stores the response lines in `'code' => 'message'` format. * - * @param string[] $responseLines Response lines to parse. + * @param array $responseLines Response lines to parse. * @return void */ protected function _bufferResponseLines(array $responseLines): void @@ -231,6 +232,9 @@ protected function _connect(): void $host = 'localhost'; if (isset($config['client'])) { + if (empty($config['client'])) { + throw new SocketException('Cannot use an empty client name.'); + } $host = $config['client']; } else { /** @var string $httpHost */ @@ -536,7 +540,7 @@ protected function _smtpSend(?string $data, $checkCode = '250'): ?string protected function _socket(): Socket { if ($this->_socket === null) { - throw new \RuntimeException('Socket is null, but must be set.'); + throw new RuntimeException('Socket is null, but must be set.'); } return $this->_socket; diff --git a/app/vendor/cakephp/cakephp/src/Mailer/TransportFactory.php b/app/vendor/cakephp/cakephp/src/Mailer/TransportFactory.php index f90fc12c..e59e9f13 100644 --- a/app/vendor/cakephp/cakephp/src/Mailer/TransportFactory.php +++ b/app/vendor/cakephp/cakephp/src/Mailer/TransportFactory.php @@ -36,7 +36,7 @@ class TransportFactory /** * An array mapping url schemes to fully qualified Transport class names * - * @var string[] + * @var array * @psalm-var array */ protected static $_dsnClassMap = [ @@ -93,6 +93,7 @@ protected static function _buildTransport(string $name): void ); } + /** @phpstan-ignore-next-line */ static::getRegistry()->load($name, static::$_config[$name]); } diff --git a/app/vendor/cakephp/cakephp/src/Mailer/TransportRegistry.php b/app/vendor/cakephp/cakephp/src/Mailer/TransportRegistry.php index cba1594e..e6477115 100644 --- a/app/vendor/cakephp/cakephp/src/Mailer/TransportRegistry.php +++ b/app/vendor/cakephp/cakephp/src/Mailer/TransportRegistry.php @@ -62,9 +62,9 @@ protected function _throwMissingClassError(string $class, ?string $plugin): void * * Part of the template method for Cake\Core\ObjectRegistry::load() * - * @param string|\Cake\Mailer\AbstractTransport $class The classname or object to make. + * @param \Cake\Mailer\AbstractTransport|string $class The classname or object to make. * @param string $alias The alias of the object. - * @param array $config An array of settings to use for the cache engine. + * @param array $config An array of settings to use for the cache engine. * @return \Cake\Mailer\AbstractTransport The constructed transport class. * @throws \RuntimeException when an object doesn't implement the correct interface. */ diff --git a/app/vendor/cakephp/cakephp/src/Network/Socket.php b/app/vendor/cakephp/cakephp/src/Network/Socket.php index f1214671..0bc610e0 100644 --- a/app/vendor/cakephp/cakephp/src/Network/Socket.php +++ b/app/vendor/cakephp/cakephp/src/Network/Socket.php @@ -33,17 +33,10 @@ class Socket { use InstanceConfigTrait; - /** - * Object description - * - * @var string - */ - public $description = 'Remote DataSource Network Socket Interface'; - /** * Default configuration settings for the socket connection * - * @var array + * @var array */ protected $_defaultConfig = [ 'persistent' => false, @@ -58,36 +51,35 @@ class Socket * * @var resource|null */ - public $connection; + protected $connection; /** * This boolean contains the current state of the Socket class * * @var bool */ - public $connected = false; + protected $connected = false; /** * This variable contains an array with the last error number (num) and string (str) * * @var array */ - public $lastError = []; + protected $lastError = []; /** - * True if the socket stream is encrypted after a Cake\Network\Socket::enableCrypto() call + * True if the socket stream is encrypted after a {@link \Cake\Network\Socket::enableCrypto()} call * * @var bool */ - public $encrypted = false; + protected $encrypted = false; /** * Contains all the encryption methods available * - * @var array + * @var array */ protected $_encryptMethods = [ - // phpcs:disable 'sslv23_client' => STREAM_CRYPTO_METHOD_SSLv23_CLIENT, 'tls_client' => STREAM_CRYPTO_METHOD_TLS_CLIENT, 'tlsv10_client' => STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT, @@ -97,8 +89,7 @@ class Socket 'tls_server' => STREAM_CRYPTO_METHOD_TLS_SERVER, 'tlsv10_server' => STREAM_CRYPTO_METHOD_TLSv1_0_SERVER, 'tlsv11_server' => STREAM_CRYPTO_METHOD_TLSv1_1_SERVER, - 'tlsv12_server' => STREAM_CRYPTO_METHOD_TLSv1_2_SERVER - // phpcs:enable + 'tlsv12_server' => STREAM_CRYPTO_METHOD_TLSv1_2_SERVER, ]; /** @@ -112,8 +103,8 @@ class Socket /** * Constructor. * - * @param array $config Socket configuration, which will be merged with the base configuration - * @see \Cake\Network\Socket::$_baseConfig + * @param array $config Socket configuration, which will be merged with the base configuration + * @see \Cake\Network\Socket::$_defaultConfig */ public function __construct(array $config = []) { @@ -192,6 +183,16 @@ public function connect(): bool return $this->connected; } + /** + * Check the connection status after calling `connect()`. + * + * @return bool + */ + public function isConnected(): bool + { + return $this->connected; + } + /** * Create a stream socket client. Mock utility. * @@ -444,11 +445,11 @@ public function __destruct() public function reset(?array $state = null): void { if (empty($state)) { - static $initalState = []; - if (empty($initalState)) { - $initalState = get_class_vars(self::class); + static $initialState = []; + if (empty($initialState)) { + $initialState = get_class_vars(self::class); } - $state = $initalState; + $state = $initialState; } foreach ($state as $property => $value) { @@ -501,4 +502,67 @@ public function enableCrypto(string $type, string $clientOrServer = 'client', bo $this->setLastError(null, $errorMessage); throw new SocketException($errorMessage); } + + /** + * Check the encryption status after calling `enableCrypto()`. + * + * @return bool + */ + public function isEncrypted(): bool + { + return $this->encrypted; + } + + /** + * Temporary magic method to allow accessing protected properties. + * + * Will be removed in 5.0. + * + * @param string $name Property name. + * @return mixed + */ + public function __get($name) + { + switch ($name) { + case 'connected': + deprecationWarning('The property `$connected` is deprecated, use `isConnected()` instead.'); + + return $this->connected; + + case 'encrypted': + deprecationWarning('The property `$encrypted` is deprecated, use `isEncrypted()` instead.'); + + return $this->encrypted; + + case 'lastError': + deprecationWarning('The property `$lastError` is deprecated, use `lastError()` instead.'); + + return $this->lastError; + + case 'connection': + deprecationWarning('The property `$connection` is deprecated.'); + + return $this->connection; + + case 'description': + deprecationWarning('The CakePHP team would love to know your use case for this property.'); + + return 'Remote DataSource Network Socket Interface'; + } + + $trace = debug_backtrace(); + $parts = explode('\\', static::class); + trigger_error( + sprintf( + 'Undefined property: %s::$%s in %s on line %s', + array_pop($parts), + $name, + $trace[0]['file'], + $trace[0]['line'] + ), + E_USER_NOTICE + ); + + return null; + } } diff --git a/app/vendor/cakephp/cakephp/src/ORM/Association.php b/app/vendor/cakephp/cakephp/src/ORM/Association.php index 218cade8..86ef6984 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Association.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Association.php @@ -106,14 +106,14 @@ abstract class Association /** * The field name in the owning side table that is used to match with the foreignKey * - * @var string|string[]|null + * @var array|string|null */ protected $_bindingKey; /** * The name of the field representing the foreign key to the table to load * - * @var string|string[] + * @var array|string */ protected $_foreignKey; @@ -121,7 +121,7 @@ abstract class Association * A list of conditions to be always included when fetching records from * the target association * - * @var array|\Closure + * @var \Closure|array */ protected $_conditions = []; @@ -135,7 +135,7 @@ abstract class Association protected $_dependent = false; /** - * Whether or not cascaded deletes should also fire callbacks. + * Whether cascaded deletes should also fire callbacks. * * @var bool */ @@ -182,14 +182,14 @@ abstract class Association * The default finder name to use for fetching rows from the target table * With array value, finder name and default options are allowed. * - * @var string|array + * @var array|string */ protected $_finder = 'all'; /** * Valid strategies for this association. Subclasses can narrow this down. * - * @var string[] + * @var array */ protected $_validStrategies = [ self::STRATEGY_JOIN, @@ -202,7 +202,7 @@ abstract class Association * list of passed options if expecting any other special key * * @param string $alias The name given to the association - * @param array $options A list of properties to be set on this object + * @param array $options A list of properties to be set on this object */ public function __construct(string $alias, array $options = []) { @@ -246,9 +246,16 @@ public function __construct(string $alias, array $options = []) * * @param string $name Name to be assigned * @return $this + * @deprecated 4.3.0 Changing the association name after object creation is + * no longer supported. The name should only be set through the constructor. */ public function setName(string $name) { + deprecationWarning( + 'Changing the association name after object creation is no longer supported.' + . ' The name should only be set through the constructor' + ); + if ($this->_targetTable !== null) { $alias = $this->_targetTable->getAlias(); if ($alias !== $name) { @@ -277,7 +284,7 @@ public function getName(): string } /** - * Sets whether or not cascaded deletes should also fire callbacks. + * Sets whether cascaded deletes should also fire callbacks. * * @param bool $cascadeCallbacks cascade callbacks switch value * @return $this @@ -290,7 +297,7 @@ public function setCascadeCallbacks(bool $cascadeCallbacks) } /** - * Gets whether or not cascaded deletes should also fire callbacks. + * Gets whether cascaded deletes should also fire callbacks. * * @return bool */ @@ -422,9 +429,9 @@ public function getTarget(): Table * Sets a list of conditions to be always included when fetching records from * the target association. * - * @param array|\Closure $conditions list of conditions to be used + * @param \Closure|array $conditions list of conditions to be used * @see \Cake\Database\Query::where() for examples on the format of the array - * @return \Cake\ORM\Association + * @return $this */ public function setConditions($conditions) { @@ -438,7 +445,7 @@ public function setConditions($conditions) * the target association. * * @see \Cake\Database\Query::where() for examples on the format of the array - * @return array|\Closure + * @return \Closure|array */ public function getConditions() { @@ -449,7 +456,7 @@ public function getConditions() * Sets the name of the field representing the binding field with the target table. * When not manually specified the primary key of the owning side table is used. * - * @param string|string[] $key the table field or fields to be used to link both tables together + * @param array|string $key the table field or fields to be used to link both tables together * @return $this */ public function setBindingKey($key) @@ -463,7 +470,7 @@ public function setBindingKey($key) * Gets the name of the field representing the binding field with the target table. * When not manually specified the primary key of the owning side table is used. * - * @return string|string[] + * @return array|string */ public function getBindingKey() { @@ -479,7 +486,7 @@ public function getBindingKey() /** * Gets the name of the field representing the foreign key to the target table. * - * @return string|string[] + * @return array|string */ public function getForeignKey() { @@ -489,7 +496,7 @@ public function getForeignKey() /** * Sets the name of the field representing the foreign key to the target table. * - * @param string|string[] $key the key or keys to be used to link both tables together + * @param array|string $key the key or keys to be used to link both tables together * @return $this */ public function setForeignKey($key) @@ -533,7 +540,7 @@ public function getDependent(): bool /** * Whether this association can be expressed directly in a query join * - * @param array $options custom options key that could alter the return value + * @param array $options custom options key that could alter the return value * @return bool */ public function canBeJoined(array $options = []): bool @@ -653,7 +660,7 @@ public function getStrategy(): string /** * Gets the default finder to use for fetching rows from the target table. * - * @return string|array + * @return array|string */ public function getFinder() { @@ -663,7 +670,7 @@ public function getFinder() /** * Sets the default finder to use for fetching rows from the target table. * - * @param string|array $finder the finder name to use or array of finder name and option. + * @param array|string $finder the finder name to use or array of finder name and option. * @return $this */ public function setFinder($finder) @@ -677,7 +684,7 @@ public function setFinder($finder) * Override this function to initialize any concrete association class, it will * get passed the original list of options used in the constructor * - * @param array $options List of options used for initialization + * @param array $options List of options used for initialization * @return void */ protected function _options(array $options): void @@ -696,8 +703,6 @@ protected function _options(array $options): void * - conditions: array with a list of conditions to filter the join with, this * will be merged with any conditions originally configured for this association * - fields: a list of fields in the target table to include in the result - * - type: The type of join to be used (e.g. INNER) - * the records found on this association * - aliasPath: A dot separated string representing the path of association names * followed from the passed query main table to this association. * - propertyPath: A dot separated string representing the path of association @@ -708,27 +713,31 @@ protected function _options(array $options): void * with this association. * * @param \Cake\ORM\Query $query the query to be altered to include the target table data - * @param array $options Any extra options or overrides to be taken in account + * @param array $options Any extra options or overrides to be taken in account * @return void - * @throws \RuntimeException if the query builder passed does not return a query - * object + * @throws \RuntimeException Unable to build the query or associations. */ public function attachTo(Query $query, array $options = []): void { $target = $this->getTarget(); - $joinType = empty($options['joinType']) ? $this->getJoinType() : $options['joinType']; $table = $target->getTable(); $options += [ 'includeFields' => true, 'foreignKey' => $this->getForeignKey(), 'conditions' => [], + 'joinType' => $this->getJoinType(), 'fields' => [], - 'type' => $joinType, 'table' => $table, 'finder' => $this->getFinder(), ]; + // This is set by joinWith to disable matching results + if ($options['fields'] === false) { + $options['fields'] = []; + $options['includeFields'] = false; + } + if (!empty($options['foreignKey'])) { $joinCondition = $this->_joinCondition($options); if ($joinCondition) { @@ -764,9 +773,11 @@ public function attachTo(Query $query, array $options = []): void $dummy->where($options['conditions']); $this->_dispatchBeforeFind($dummy); - $joinOptions = ['table' => 1, 'conditions' => 1, 'type' => 1]; - $options['conditions'] = $dummy->clause('where'); - $query->join([$this->_name => array_intersect_key($options, $joinOptions)]); + $query->join([$this->_name => [ + 'table' => $options['table'], + 'conditions' => $dummy->clause('where'), + 'type' => $options['joinType'], + ]]); $this->_appendFields($query, $dummy, $options); $this->_formatAssociationResults($query, $dummy, $options); @@ -779,7 +790,7 @@ public function attachTo(Query $query, array $options = []): void * records where there is no match with this association. * * @param \Cake\ORM\Query $query The query to modify - * @param array $options Options array containing the `negateMatch` key. + * @param array $options Options array containing the `negateMatch` key. * @return void */ protected function _appendNotMatching(Query $query, array $options): void @@ -802,7 +813,7 @@ protected function _appendNotMatching(Query $query, array $options): void * @param array $row The row to transform * @param string $nestKey The array key under which the results for this association * should be found - * @param bool $joined Whether or not the row is a result of a direct join + * @param bool $joined Whether the row is a result of a direct join * with this association * @param string|null $targetProperty The property name in the source results where the association * data shuld be nested in. Will use the default one if not provided. @@ -827,7 +838,7 @@ public function transformRow(array $row, string $nestKey, bool $joined, ?string * joined or fetched externally. * * @param array $row The row to set a default on. - * @param bool $joined Whether or not the row is a result of a direct join + * @param bool $joined Whether the row is a result of a direct join * with this association * @return array */ @@ -846,9 +857,9 @@ public function defaultRowValue(array $row, bool $joined): array * and modifies the query accordingly based of this association * configuration * - * @param string|array|null $type the type of query to perform, if an array is passed, + * @param array|string|null $type the type of query to perform, if an array is passed, * it will be interpreted as the `$options` parameter - * @param array $options The options to for the find + * @param array $options The options to for the find * @see \Cake\ORM\Table::find() * @return \Cake\ORM\Query */ @@ -866,7 +877,7 @@ public function find($type = null, array $options = []): Query * Proxies the operation to the target table's exists method after * appending the default conditions for this association * - * @param array|\Closure|\Cake\Database\ExpressionInterface $conditions The conditions to use + * @param \Cake\Database\ExpressionInterface|\Closure|array|string|null $conditions The conditions to use * for checking if any record matches. * @see \Cake\ORM\Table::exists() * @return bool @@ -884,7 +895,7 @@ public function exists($conditions): bool * Proxies the update operation to the target table's updateAll method * * @param array $fields A hash of field => new value. - * @param mixed $conditions Conditions to be used, accepts anything Query::where() + * @param \Cake\Database\ExpressionInterface|\Closure|array|string|null $conditions Conditions to be used, accepts anything Query::where() * can take. * @see \Cake\ORM\Table::updateAll() * @return int Count Returns the affected rows. @@ -901,7 +912,7 @@ public function updateAll(array $fields, $conditions): int /** * Proxies the delete operation to the target table's deleteAll method * - * @param mixed $conditions Conditions to be used, accepts anything Query::where() + * @param \Cake\Database\ExpressionInterface|\Closure|array|string|null $conditions Conditions to be used, accepts anything Query::where() * can take. * @return int Returns the number of affected rows. * @see \Cake\ORM\Table::deleteAll() @@ -919,7 +930,7 @@ public function deleteAll($conditions): int * Returns true if the eager loading process will require a set of the owning table's * binding keys in order to use them as a filter in the finder query. * - * @param array $options The options containing the strategy to be used. + * @param array $options The options containing the strategy to be used. * @return bool true if a list of keys will be required */ public function requiresKeys(array $options = []): bool @@ -947,7 +958,7 @@ protected function _dispatchBeforeFind(Query $query): void * * @param \Cake\ORM\Query $query the query that will get the fields appended to * @param \Cake\ORM\Query $surrogate the query having the fields to be copied from - * @param array $options options passed to the method `attachTo` + * @param array $options options passed to the method `attachTo` * @return void */ protected function _appendFields(Query $query, Query $surrogate, array $options): void @@ -956,25 +967,17 @@ protected function _appendFields(Query $query, Query $surrogate, array $options) return; } - $fields = $surrogate->clause('select') ?: $options['fields']; - $target = $this->_targetTable; - $autoFields = $surrogate->isAutoFieldsEnabled(); - - if (empty($fields) && !$autoFields) { - if ($options['includeFields'] && ($fields === null || $fields !== false)) { - $fields = $target->getSchema()->columns(); - } - } + $fields = array_merge($surrogate->clause('select'), $options['fields']); - if ($autoFields === true) { - $fields = array_filter((array)$fields); - $fields = array_merge($fields, $target->getSchema()->columns()); + if ( + (empty($fields) && $options['includeFields']) || + $surrogate->isAutoFieldsEnabled() + ) { + $fields = array_merge($fields, $this->_targetTable->getSchema()->columns()); } - if ($fields) { - $query->select($query->aliasFields($fields, $this->_name)); - } - $query->addDefaultTypes($target); + $query->select($query->aliasFields($fields, $this->_name)); + $query->addDefaultTypes($this->_targetTable); } /** @@ -987,7 +990,7 @@ protected function _appendFields(Query $query, Query $surrogate, array $options) * @param \Cake\ORM\Query $query the query that will get the formatter applied to * @param \Cake\ORM\Query $surrogate the query having formatters for the associated * target table. - * @param array $options options passed to the method `attachTo` + * @param array $options options passed to the method `attachTo` * @return void */ protected function _formatAssociationResults(Query $query, Query $surrogate, array $options): void @@ -1041,7 +1044,7 @@ protected function _formatAssociationResults(Query $query, Query $surrogate, arr * * @param \Cake\ORM\Query $query the query that will get the associations attached to * @param \Cake\ORM\Query $surrogate the query having the containments to be attached - * @param array $options options passed to the method `attachTo` + * @param array $options options passed to the method `attachTo` * @return void */ protected function _bindNewAssociations(Query $query, Query $surrogate, array $options): void @@ -1077,7 +1080,7 @@ protected function _bindNewAssociations(Query $query, Query $surrogate, array $o * Returns a single or multiple conditions to be appended to the generated join * clause for getting the results on the target table. * - * @param array $options list of options passed to attachTo method + * @param array $options list of options passed to attachTo method * @return array * @throws \RuntimeException if the number of columns in the foreignKey do not * match the number of columns in the source table primaryKey @@ -1130,7 +1133,7 @@ protected function _joinCondition(array $options): array * $query->contain(['Comments' => ['finder' => ['translations' => []]]]); * $query->contain(['Comments' => ['finder' => ['translations' => ['locales' => ['en_US']]]]]); * - * @param string|array $finderData The finder name or an array having the name as key + * @param array|string $finderData The finder name or an array having the name as key * and options as value. * @return array */ @@ -1192,7 +1195,7 @@ abstract public function type(): string; /** * Eager loads a list of records in the target table that are related to another - * set of records in the source table. Source records can specified in two ways: + * set of records in the source table. Source records can be specified in two ways: * first one is by passing a Query object setup to find on the source table and * the other way is by explicitly passing an array of primary key values from * the source table. @@ -1217,7 +1220,7 @@ abstract public function type(): string; * - strategy: The name of strategy to use for finding target table records * - nestKey: The array key under which results will be found when transforming the row * - * @param array $options The options for eager loading. + * @param array $options The options for eager loading. * @return \Closure */ abstract public function eagerLoader(array $options): Closure; @@ -1229,13 +1232,13 @@ abstract public function eagerLoader(array $options): Closure; * required. * * @param \Cake\Datasource\EntityInterface $entity The entity that started the cascaded delete. - * @param array $options The options for the original delete. + * @param array $options The options for the original delete. * @return bool Success */ abstract public function cascadeDelete(EntityInterface $entity, array $options = []): bool; /** - * Returns whether or not the passed table is the owning side for this + * Returns whether the passed table is the owning side for this * association. This means that rows in the 'target' table would miss important * or required information if the row in 'source' did not exist. * @@ -1249,7 +1252,7 @@ abstract public function isOwningSide(Table $side): bool; * the saving operation to the target table. * * @param \Cake\Datasource\EntityInterface $entity the data to be saved - * @param array $options The options for saving associated data. + * @param array $options The options for saving associated data. * @return \Cake\Datasource\EntityInterface|false false if $entity could not be saved, otherwise it returns * the saved entity * @see \Cake\ORM\Table::save() diff --git a/app/vendor/cakephp/cakephp/src/ORM/Association/BelongsTo.php b/app/vendor/cakephp/cakephp/src/ORM/Association/BelongsTo.php index fb354148..1950b256 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Association/BelongsTo.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Association/BelongsTo.php @@ -36,7 +36,7 @@ class BelongsTo extends Association /** * Valid strategies for this type of association * - * @var string[] + * @var array */ protected $_validStrategies = [ self::STRATEGY_JOIN, @@ -46,7 +46,7 @@ class BelongsTo extends Association /** * Gets the name of the field representing the foreign key to the target table. * - * @return string|string[] + * @return array|string */ public function getForeignKey() { @@ -63,7 +63,7 @@ public function getForeignKey() * BelongsTo associations are never cleared in a cascading delete scenario. * * @param \Cake\Datasource\EntityInterface $entity The entity that started the cascaded delete. - * @param array $options The options for the original delete. + * @param array $options The options for the original delete. * @return bool Success. */ public function cascadeDelete(EntityInterface $entity, array $options = []): bool @@ -84,7 +84,7 @@ protected function _propertyName(): string } /** - * Returns whether or not the passed table is the owning side for this + * Returns whether the passed table is the owning side for this * association. This means that rows in the 'target' table would miss important * or required information if the row in 'source' did not exist. * @@ -113,7 +113,7 @@ public function type(): string * `$options` * * @param \Cake\Datasource\EntityInterface $entity an entity from the source table - * @param array $options options to be passed to the save method in the target table + * @param array $options options to be passed to the save method in the target table * @return \Cake\Datasource\EntityInterface|false false if $entity could not be saved, otherwise it returns * the saved entity * @see \Cake\ORM\Table::save() @@ -144,8 +144,8 @@ public function saveAssociated(EntityInterface $entity, array $options = []) * Returns a single or multiple conditions to be appended to the generated join * clause for getting the results on the target table. * - * @param array $options list of options passed to attachTo method - * @return \Cake\Database\Expression\IdentifierExpression[] + * @param array $options list of options passed to attachTo method + * @return array<\Cake\Database\Expression\IdentifierExpression> * @throws \RuntimeException if the number of columns in the foreignKey do not * match the number of columns in the target table primaryKey */ diff --git a/app/vendor/cakephp/cakephp/src/ORM/Association/BelongsToMany.php b/app/vendor/cakephp/cakephp/src/ORM/Association/BelongsToMany.php index 1ba41d9e..a781e32b 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Association/BelongsToMany.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Association/BelongsToMany.php @@ -25,6 +25,7 @@ use Cake\ORM\Association\Loader\SelectWithPivotLoader; use Cake\ORM\Query; use Cake\ORM\Table; +use Cake\Utility\Hash; use Cake\Utility\Inflector; use Closure; use InvalidArgumentException; @@ -106,21 +107,21 @@ class BelongsToMany extends Association /** * The name of the field representing the foreign key to the target table * - * @var string|string[]|null + * @var array|string|null */ protected $_targetForeignKey; /** * The table instance for the junction relation. * - * @var string|\Cake\ORM\Table + * @var \Cake\ORM\Table|string */ protected $_through; /** * Valid strategies for this type of association * - * @var string[] + * @var array */ protected $_validStrategies = [ self::STRATEGY_SELECT, @@ -161,7 +162,7 @@ class BelongsToMany extends Association /** * Sets the name of the field representing the foreign key to the target table. * - * @param string|string[] $key the key to be used to link both tables together + * @param array|string $key the key to be used to link both tables together * @return $this */ public function setTargetForeignKey($key) @@ -174,7 +175,7 @@ public function setTargetForeignKey($key) /** * Gets the name of the field representing the foreign key to the target table. * - * @return string|string[] + * @return array|string */ public function getTargetForeignKey() { @@ -188,7 +189,7 @@ public function getTargetForeignKey() /** * Whether this association can be expressed directly in a query join * - * @param array $options custom options key that could alter the return value + * @param array $options custom options key that could alter the return value * @return bool if the 'matching' key in $option is true then this function * will return true, false otherwise */ @@ -200,7 +201,7 @@ public function canBeJoined(array $options = []): bool /** * Gets the name of the field representing the foreign key to the source table. * - * @return string|string[] + * @return array|string */ public function getForeignKey() { @@ -251,7 +252,7 @@ public function defaultRowValue(array $row, bool $joined): array * Sets the table instance for the junction relation. If no arguments * are passed, the current configured table instance is returned * - * @param string|\Cake\ORM\Table|null $table Name or instance for the join table + * @param \Cake\ORM\Table|string|null $table Name or instance for the join table * @return \Cake\ORM\Table * @throws \InvalidArgumentException If the expected associations are incompatible with existing associations. */ @@ -425,6 +426,7 @@ protected function _generateJunctionAssociations(Table $junction, Table $source, if (!$junction->hasAssociation($sAlias)) { $junction->belongsTo($sAlias, [ + 'bindingKey' => $this->getBindingKey(), 'foreignKey' => $this->getForeignKey(), 'targetTable' => $source, ]); @@ -445,7 +447,7 @@ protected function _generateJunctionAssociations(Table $junction, Table $source, * - type: The type of join to be used (e.g. INNER) * * @param \Cake\ORM\Query $query the query to be altered to include the target table data - * @param array $options Any extra options or overrides to be taken in account + * @param array $options Any extra options or overrides to be taken in account * @return void */ public function attachTo(Query $query, array $options = []): void @@ -461,10 +463,7 @@ public function attachTo(Query $query, array $options = []): void $cond = $belongsTo->_joinCondition(['foreignKey' => $belongsTo->getForeignKey()]); $cond += $this->junctionConditions(); - $includeFields = null; - if (isset($options['includeFields'])) { - $includeFields = $options['includeFields']; - } + $includeFields = $options['includeFields'] ?? null; // Attach the junction table as well we need it to populate _joinData. $assoc = $this->_targetTable->getAssociation($junction->getAlias()); @@ -492,9 +491,7 @@ protected function _appendNotMatching(Query $query, array $options): void if (empty($options['negateMatch'])) { return; } - if (!isset($options['conditions'])) { - $options['conditions'] = []; - } + $options['conditions'] = $options['conditions'] ?? []; $junction = $this->junction(); $belongsTo = $junction->getAssociation($this->getSource()->getAlias()); $conds = $belongsTo->_joinCondition(['foreignKey' => $belongsTo->getForeignKey()]); @@ -539,7 +536,7 @@ public function type(): string /** * Return false as join conditions are defined in the junction table * - * @param array $options list of options passed to attachTo method + * @param array $options list of options passed to attachTo method * @return array */ protected function _joinCondition(array $options): array @@ -578,7 +575,7 @@ public function eagerLoader(array $options): Closure * Clear out the data in the junction table for a given entity. * * @param \Cake\Datasource\EntityInterface $entity The entity that started the cascading delete. - * @param array $options The options for the original delete. + * @param array $options The options for the original delete. * @return bool Success. */ public function cascadeDelete(EntityInterface $entity, array $options = []): bool @@ -676,7 +673,7 @@ public function getSaveStrategy(): string * not deleted. * * @param \Cake\Datasource\EntityInterface $entity an entity from the source table - * @param array $options options to be passed to the save method in the target table + * @param array $options options to be passed to the save method in the target table * @throws \InvalidArgumentException if the property representing the association * in the parent entity cannot be traversed * @return \Cake\Datasource\EntityInterface|false false if $entity could not be saved, otherwise it returns @@ -716,7 +713,7 @@ public function saveAssociated(EntityInterface $entity, array $options = []) * entities to be saved. * @param array $entities list of entities to persist in target table and to * link to the parent entity - * @param array $options list of options accepted by `Table::save()` + * @param array $options list of options accepted by `Table::save()` * @throws \InvalidArgumentException if the property representing the association * in the parent entity cannot be traversed * @return \Cake\Datasource\EntityInterface|false The parent entity after all links have been @@ -725,10 +722,12 @@ public function saveAssociated(EntityInterface $entity, array $options = []) protected function _saveTarget(EntityInterface $parentEntity, array $entities, $options) { $joinAssociations = false; - if (!empty($options['associated'][$this->_junctionProperty]['associated'])) { - $joinAssociations = $options['associated'][$this->_junctionProperty]['associated']; + if (isset($options['associated']) && is_array($options['associated'])) { + if (!empty($options['associated'][$this->_junctionProperty]['associated'])) { + $joinAssociations = $options['associated'][$this->_junctionProperty]['associated']; + } + unset($options['associated'][$this->_junctionProperty]); } - unset($options['associated'][$this->_junctionProperty]); $table = $this->getTarget(); $original = $entities; @@ -778,9 +777,9 @@ protected function _saveTarget(EntityInterface $parentEntity, array $entities, $ * * @param \Cake\Datasource\EntityInterface $sourceEntity the entity from source table in this * association - * @param \Cake\Datasource\EntityInterface[] $targetEntities list of entities to link to link to the source entity using the + * @param array<\Cake\Datasource\EntityInterface> $targetEntities list of entities to link to link to the source entity using the * junction table - * @param array $options list of options accepted by `Table::save()` + * @param array $options list of options accepted by `Table::save()` * @return bool success */ protected function _saveLinks(EntityInterface $sourceEntity, array $targetEntities, array $options): bool @@ -810,7 +809,7 @@ protected function _saveLinks(EntityInterface $sourceEntity, array $targetEntiti ); // Keys were changed, the junction table record _could_ be // new. By clearing the primary key values, and marking the entity - // as new, we let save() sort out whether or not we have a new link + // as new, we let save() sort out whether we have a new link // or if we are updating an existing link. if ($changedKeys) { $joint->setNew(true); @@ -852,9 +851,9 @@ protected function _saveLinks(EntityInterface $sourceEntity, array $targetEntiti * * @param \Cake\Datasource\EntityInterface $sourceEntity the row belonging to the `source` side * of this association - * @param \Cake\Datasource\EntityInterface[] $targetEntities list of entities belonging to the `target` side + * @param array<\Cake\Datasource\EntityInterface> $targetEntities list of entities belonging to the `target` side * of this association - * @param array $options list of options to be passed to the internal `save` call + * @param array $options list of options to be passed to the internal `save` call * @throws \InvalidArgumentException when any of the values in $targetEntities is * detected to not be already persisted * @return bool true on success, false otherwise @@ -884,7 +883,7 @@ function () use ($sourceEntity, $targetEntities, $options) { * Additionally to the default options accepted by `Table::delete()`, the following * keys are supported: * - * - cleanProperty: Whether or not to remove all the objects in `$targetEntities` that + * - cleanProperty: Whether to remove all the objects in `$targetEntities` that * are stored in `$sourceEntity` (default: true) * * By default this method will unset each of the entity objects stored inside the @@ -902,9 +901,9 @@ function () use ($sourceEntity, $targetEntities, $options) { * * @param \Cake\Datasource\EntityInterface $sourceEntity An entity persisted in the source table for * this association. - * @param \Cake\Datasource\EntityInterface[] $targetEntities List of entities persisted in the target table for + * @param array<\Cake\Datasource\EntityInterface> $targetEntities List of entities persisted in the target table for * this association. - * @param array|bool $options List of options to be passed to the internal `delete` call, + * @param array|bool $options List of options to be passed to the internal `delete` call, * or a `boolean` as `cleanProperty` key shortcut. * @throws \InvalidArgumentException If non persisted entities are passed or if * any of them is lacking a primary key value. @@ -932,12 +931,13 @@ function () use ($sourceEntity, $targetEntities, $options): void { } ); + /** @var array<\Cake\Datasource\EntityInterface> $existing */ $existing = $sourceEntity->get($property) ?: []; if (!$options['cleanProperty'] || empty($existing)) { return true; } - /** @var \SplObjectStorage<\Cake\Datasource\EntityInterface, null> $storage*/ + /** @var \SplObjectStorage<\Cake\Datasource\EntityInterface, null> $storage */ $storage = new SplObjectStorage(); foreach ($targetEntities as $e) { $storage->attach($e); @@ -969,7 +969,7 @@ public function setConditions($conditions) /** * Sets the current join table, either the name of the Table instance or the instance itself. * - * @param string|\Cake\ORM\Table $through Name of the Table instance or the instance itself + * @param \Cake\ORM\Table|string $through Name of the Table instance or the instance itself * @return $this */ public function setThrough($through) @@ -982,7 +982,7 @@ public function setThrough($through) /** * Gets the current join table, either the name of the Table instance or the instance itself. * - * @return string|\Cake\ORM\Table + * @return \Cake\ORM\Table|string */ public function getThrough() { @@ -995,7 +995,7 @@ public function getThrough() * Any string expressions, or expression objects will * also be returned in this list. * - * @return mixed Generally an array. If the conditions + * @return array|\Closure|null Generally an array. If the conditions * are not an array, the association conditions will be * returned unmodified. */ @@ -1061,9 +1061,9 @@ protected function junctionConditions(): array * If your association includes conditions or a finder, the junction table will be * included in the query's contained associations. * - * @param string|array|null $type the type of query to perform, if an array is passed, + * @param array|string|null $type the type of query to perform, if an array is passed, * it will be interpreted as the `$options` parameter - * @param array $options The options to for the find + * @param array $options The options to for the find * @see \Cake\ORM\Table::find() * @return \Cake\ORM\Query */ @@ -1162,7 +1162,7 @@ protected function _appendJunctionJoin(Query $query, ?array $conditions = null): * @param \Cake\Datasource\EntityInterface $sourceEntity an entity persisted in the source table for * this association * @param array $targetEntities list of entities from the target table to be linked - * @param array $options list of options to be passed to the internal `save`/`delete` calls + * @param array $options list of options to be passed to the internal `save`/`delete` calls * when persisting/updating new links, or deleting existing ones * @throws \InvalidArgumentException if non persisted entities are passed or if * any of them is lacking a primary key value @@ -1173,7 +1173,7 @@ public function replaceLinks(EntityInterface $sourceEntity, array $targetEntitie $bindingKey = (array)$this->getBindingKey(); $primaryValue = $sourceEntity->extract($bindingKey); - if (count(array_filter($primaryValue, 'strlen')) !== count($bindingKey)) { + if (count(Hash::filter($primaryValue)) !== count($bindingKey)) { $message = 'Could not find primary key value for source entity'; throw new InvalidArgumentException($message); } @@ -1184,30 +1184,33 @@ function () use ($sourceEntity, $targetEntities, $primaryValue, $options) { $target = $this->getTarget(); $foreignKey = (array)$this->getForeignKey(); - $prefixedForeignKey = array_map([$junction, 'aliasField'], $foreignKey); + $assocForeignKey = (array)$junction->getAssociation($target->getAlias())->getForeignKey(); + $prefixedForeignKey = array_map([$junction, 'aliasField'], $foreignKey); $junctionPrimaryKey = (array)$junction->getPrimaryKey(); - $assocForeignKey = (array)$junction->getAssociation($target->getAlias())->getForeignKey(); + $junctionQueryAlias = $junction->getAlias() . '__matches'; - $keys = array_combine($foreignKey, $prefixedForeignKey); + $keys = $matchesConditions = []; foreach (array_merge($assocForeignKey, $junctionPrimaryKey) as $key) { - $keys[$key] = $junction->aliasField($key); + $aliased = $junction->aliasField($key); + $keys[$key] = $aliased; + $matchesConditions[$aliased] = new IdentifierExpression($junctionQueryAlias . '.' . $key); } - // Find existing rows so that we can diff with new entities. - // Only hydrate primary/foreign key columns to save time. - // Attach joins first to ensure where conditions have correct - // column types set. - $existing = $this->_appendJunctionJoin($this->find()) + // Use association to create row selection + // with finders & association conditions. + $matches = $this->_appendJunctionJoin($this->find()) ->select($keys) ->where(array_combine($prefixedForeignKey, $primaryValue)); - // Because we're aliasing key fields to look like they are not - // from joined table we need to overwrite the type map as the junction - // table can have a surrogate primary key that doesn't share a type - // with the target table. - $junctionTypes = array_intersect_key($junction->getSchema()->typeMap(), $keys); - $existing->getSelectTypeMap()->setTypes($junctionTypes); + // Create a subquery join to ensure we get + // the correct entity passed to callbacks. + $existing = $junction->query() + ->from([$junctionQueryAlias => $matches]) + ->innerJoin( + [$junction->getAlias() => $junction->getTable()], + $matchesConditions + ); $jointEntities = $this->_collectJointEntities($sourceEntity, $targetEntities); $inserts = $this->_diffLinks($existing, $jointEntities, $targetEntities, $options); @@ -1244,10 +1247,10 @@ function () use ($sourceEntity, $targetEntities, $primaryValue, $options) { * `$targetEntities` that were not deleted from calculating the difference. * * @param \Cake\ORM\Query $existing a query for getting existing links - * @param \Cake\Datasource\EntityInterface[] $jointEntities link entities that should be persisted + * @param array<\Cake\Datasource\EntityInterface> $jointEntities link entities that should be persisted * @param array $targetEntities entities in target table that are related to * the `$jointEntities` - * @param array $options list of options accepted by `Table::delete()` + * @param array $options list of options accepted by `Table::delete()` * @return array|false Array of entities not deleted or false in case of deletion failure for atomic saves. */ protected function _diffLinks( @@ -1315,7 +1318,7 @@ protected function _diffLinks( * * @param \Cake\Datasource\EntityInterface $sourceEntity the row belonging to the `source` side * of this association - * @param \Cake\Datasource\EntityInterface[] $targetEntities list of entities belonging to the `target` side + * @param array<\Cake\Datasource\EntityInterface> $targetEntities list of entities belonging to the `target` side * of this association * @return bool * @throws \InvalidArgumentException @@ -1347,7 +1350,7 @@ protected function _checkPersistenceStatus(EntityInterface $sourceEntity, array * association. * @throws \InvalidArgumentException if any of the entities is lacking a primary * key value - * @return \Cake\Datasource\EntityInterface[] + * @return array<\Cake\Datasource\EntityInterface> */ protected function _collectJointEntities(EntityInterface $sourceEntity, array $targetEntities): array { @@ -1452,7 +1455,7 @@ protected function _junctionTableName(?string $name = null): string /** * Parse extra options passed in the constructor. * - * @param array $options original list of options passed in constructor + * @param array $options original list of options passed in constructor * @return void */ protected function _options(array $options): void diff --git a/app/vendor/cakephp/cakephp/src/ORM/Association/DependentDeleteHelper.php b/app/vendor/cakephp/cakephp/src/ORM/Association/DependentDeleteHelper.php index 1b7a7d80..52b6289b 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Association/DependentDeleteHelper.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Association/DependentDeleteHelper.php @@ -33,7 +33,7 @@ class DependentDeleteHelper * * @param \Cake\ORM\Association $association The association callbacks are being cascaded on. * @param \Cake\Datasource\EntityInterface $entity The entity that started the cascaded delete. - * @param array $options The options for the original delete. + * @param array $options The options for the original delete. * @return bool Success. */ public function cascadeDelete(Association $association, EntityInterface $entity, array $options = []): bool @@ -45,7 +45,11 @@ public function cascadeDelete(Association $association, EntityInterface $entity, /** @psalm-suppress InvalidArgument */ $foreignKey = array_map([$association, 'aliasField'], (array)$association->getForeignKey()); $bindingKey = (array)$association->getBindingKey(); - $conditions = array_combine($foreignKey, $entity->extract($bindingKey)); + $bindingValue = $entity->extract($bindingKey); + if (in_array(null, $bindingValue, true)) { + return true; + } + $conditions = array_combine($foreignKey, $bindingValue); if ($association->getCascadeCallbacks()) { foreach ($association->find()->where($conditions)->all()->toList() as $related) { diff --git a/app/vendor/cakephp/cakephp/src/ORM/Association/HasMany.php b/app/vendor/cakephp/cakephp/src/ORM/Association/HasMany.php index fa59e21f..9dbeac72 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Association/HasMany.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Association/HasMany.php @@ -60,7 +60,7 @@ class HasMany extends Association /** * Valid strategies for this type of association * - * @var string[] + * @var array */ protected $_validStrategies = [ self::STRATEGY_SELECT, @@ -89,7 +89,7 @@ class HasMany extends Association protected $_saveStrategy = self::SAVE_APPEND; /** - * Returns whether or not the passed table is the owning side for this + * Returns whether the passed table is the owning side for this * association. This means that rows in the 'target' table would miss important * or required information if the row in 'source' did not exist. * @@ -137,7 +137,7 @@ public function getSaveStrategy(): string * `$options` * * @param \Cake\Datasource\EntityInterface $entity an entity from the source table - * @param array $options options to be passed to the save method in the target table + * @param array $options options to be passed to the save method in the target table * @return \Cake\Datasource\EntityInterface|false false if $entity could not be saved, otherwise it returns * the saved entity * @see \Cake\ORM\Table::save() @@ -199,7 +199,7 @@ public function saveAssociated(EntityInterface $entity, array $options = []) * entities to be saved. * @param array $entities list of entities * to persist in target table and to link to the parent entity - * @param array $options list of options accepted by `Table::save()`. + * @param array $options list of options accepted by `Table::save()`. * @return bool `true` on success, `false` otherwise. */ protected function _saveTarget( @@ -267,7 +267,7 @@ protected function _saveTarget( * of this association * @param array $targetEntities list of entities belonging to the `target` side * of this association - * @param array $options list of options to be passed to the internal `save` call + * @param array $options list of options to be passed to the internal `save` call * @return bool true on success, false otherwise */ public function link(EntityInterface $sourceEntity, array $targetEntities, array $options = []): bool @@ -311,7 +311,7 @@ public function link(EntityInterface $sourceEntity, array $targetEntities, array * Additionally to the default options accepted by `Table::delete()`, the following * keys are supported: * - * - cleanProperty: Whether or not to remove all the objects in `$targetEntities` that + * - cleanProperty: Whether to remove all the objects in `$targetEntities` that * are stored in `$sourceEntity` (default: true) * * By default this method will unset each of the entity objects stored inside the @@ -335,7 +335,7 @@ public function link(EntityInterface $sourceEntity, array $targetEntities, array * this association * @param array $targetEntities list of entities persisted in the target table for * this association - * @param array|bool $options list of options to be passed to the internal `delete` call. + * @param array|bool $options list of options to be passed to the internal `delete` call. * If boolean it will be used a value for "cleanProperty" option. * @throws \InvalidArgumentException if non persisted entities are passed or if * any of them is lacking a primary key value @@ -424,7 +424,7 @@ function ($assoc) use ($targetEntities) { * @param \Cake\Datasource\EntityInterface $sourceEntity an entity persisted in the source table for * this association * @param array $targetEntities list of entities from the target table to be linked - * @param array $options list of options to be passed to the internal `save`/`delete` calls + * @param array $options list of options to be passed to the internal `save`/`delete` calls * when persisting/updating new links, or deleting existing ones * @throws \InvalidArgumentException if non persisted entities are passed or if * any of them is lacking a primary key value @@ -456,7 +456,7 @@ public function replace(EntityInterface $sourceEntity, array $targetEntities, ar * @param \Cake\Datasource\EntityInterface $entity the entity which should have its associated entities unassigned * @param \Cake\ORM\Table $target The associated table * @param iterable $remainingEntities Entities that should not be deleted - * @param array $options list of options accepted by `Table::delete()` + * @param array $options list of options accepted by `Table::delete()` * @return bool success */ protected function _unlinkAssociated( @@ -504,7 +504,7 @@ function ($v) { * @param array $foreignKey array of foreign key properties * @param \Cake\ORM\Table $target The associated table * @param array $conditions The conditions that specifies what are the objects to be unlinked - * @param array $options list of options accepted by `Table::delete()` + * @param array $options list of options accepted by `Table::delete()` * @return bool success */ protected function _unlink(array $foreignKey, Table $target, array $conditions = [], array $options = []): bool @@ -575,7 +575,7 @@ public function type(): string /** * Whether this association can be expressed directly in a query join * - * @param array $options custom options key that could alter the return value + * @param array $options custom options key that could alter the return value * @return bool if the 'matching' key in $option is true then this function * will return true, false otherwise */ @@ -587,7 +587,7 @@ public function canBeJoined(array $options = []): bool /** * Gets the name of the field representing the foreign key to the source table. * - * @return string|string[] + * @return array|string */ public function getForeignKey() { @@ -637,7 +637,7 @@ public function defaultRowValue(array $row, bool $joined): array /** * Parse extra options passed in the constructor. * - * @param array $options original list of options passed in constructor + * @param array $options original list of options passed in constructor * @return void */ protected function _options(array $options): void diff --git a/app/vendor/cakephp/cakephp/src/ORM/Association/HasOne.php b/app/vendor/cakephp/cakephp/src/ORM/Association/HasOne.php index bd10694b..b48ea721 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Association/HasOne.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Association/HasOne.php @@ -34,7 +34,7 @@ class HasOne extends Association /** * Valid strategies for this type of association * - * @var string[] + * @var array */ protected $_validStrategies = [ self::STRATEGY_JOIN, @@ -44,7 +44,7 @@ class HasOne extends Association /** * Gets the name of the field representing the foreign key to the target table. * - * @return string|string[] + * @return array|string */ public function getForeignKey() { @@ -68,7 +68,7 @@ protected function _propertyName(): string } /** - * Returns whether or not the passed table is the owning side for this + * Returns whether the passed table is the owning side for this * association. This means that rows in the 'target' table would miss important * or required information if the row in 'source' did not exist. * @@ -97,7 +97,7 @@ public function type(): string * `$options` * * @param \Cake\Datasource\EntityInterface $entity an entity from the source table - * @param array $options options to be passed to the save method in the target table + * @param array $options options to be passed to the save method in the target table * @return \Cake\Datasource\EntityInterface|false false if $entity could not be saved, otherwise it returns * the saved entity * @see \Cake\ORM\Table::save() diff --git a/app/vendor/cakephp/cakephp/src/ORM/Association/Loader/SelectLoader.php b/app/vendor/cakephp/cakephp/src/ORM/Association/Loader/SelectLoader.php index f3be34f5..6a2591d4 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Association/Loader/SelectLoader.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Association/Loader/SelectLoader.php @@ -56,7 +56,7 @@ class SelectLoader /** * The foreignKey to the target association * - * @var string|array + * @var array|string */ protected $foreignKey; @@ -99,7 +99,7 @@ class SelectLoader * Copies the options array to properties in this class. The keys in the array correspond * to properties in this class. * - * @param array $options Properties to be copied to this class + * @param array $options Properties to be copied to this class */ public function __construct(array $options) { @@ -118,7 +118,7 @@ public function __construct(array $options) * Returns a callable that can be used for injecting association results into a given * iterator. The options accepted by this method are the same as `Association::eagerLoader()` * - * @param array $options Same options as `Association::eagerLoader()` + * @param array $options Same options as `Association::eagerLoader()` * @return \Closure */ public function buildEagerLoader(array $options): Closure @@ -151,7 +151,7 @@ protected function _defaultOptions(): array * in the target table that are associated to those specified in $options from * the source table * - * @param array $options options accepted by eagerLoader() + * @param array $options options accepted by eagerLoader() * @return \Cake\ORM\Query * @throws \InvalidArgumentException When a key is required for associations but not selected. */ @@ -161,10 +161,7 @@ protected function _buildQuery(array $options): Query $filter = $options['keys']; $useSubquery = $options['strategy'] === Association::STRATEGY_SUBQUERY; $finder = $this->finder; - - if (!isset($options['fields'])) { - $options['fields'] = []; - } + $options['fields'] = $options['fields'] ?? []; /** @var \Cake\ORM\Query $query */ $query = $finder(); @@ -178,6 +175,11 @@ protected function _buildQuery(array $options): Query ->where($options['conditions']) ->eagerLoaded(true) ->enableHydration($options['query']->isHydrationEnabled()); + if ($options['query']->isResultsCastingEnabled()) { + $fetchQuery->enableResultsCasting(); + } else { + $fetchQuery->disableResultsCasting(); + } if ($useSubquery) { $filter = $this->_buildSubquery($options['query']); @@ -215,7 +217,7 @@ protected function _buildQuery(array $options): Query * $query->contain(['Comments' => ['finder' => ['translations' => []]]]); * $query->contain(['Comments' => ['finder' => ['translations' => ['locales' => ['en_US']]]]]); * - * @param string|array $finderData The finder name or an array having the name as key + * @param array|string $finderData The finder name or an array having the name as key * and options as value. * @return array */ @@ -236,12 +238,16 @@ protected function _extractFinder($finderData): array * If the required fields are missing, throws an exception. * * @param \Cake\ORM\Query $fetchQuery The association fetching query - * @param array $key The foreign key fields to check + * @param array $key The foreign key fields to check * @return void * @throws \InvalidArgumentException */ protected function _assertFieldsPresent(Query $fetchQuery, array $key): void { + if ($fetchQuery->isAutoFieldsEnabled()) { + return; + } + $select = $fetchQuery->aliasFields($fetchQuery->clause('select')); if (empty($select)) { return; @@ -279,7 +285,7 @@ protected function _assertFieldsPresent(Query $fetchQuery, array $key): void * filtering needs to be done using a subquery. * * @param \Cake\ORM\Query $query Target table's query - * @param string|string[] $key the fields that should be used for filtering + * @param array|string $key the fields that should be used for filtering * @param \Cake\ORM\Query $subquery The Subquery to use for filtering * @return \Cake\ORM\Query */ @@ -315,7 +321,7 @@ protected function _addFilteringJoin(Query $query, $key, $subquery): Query * target table query given a filter key and some filtering values. * * @param \Cake\ORM\Query $query Target table's query - * @param string|array $key The fields that should be used for filtering + * @param array|string $key The fields that should be used for filtering * @param mixed $filter The value that should be used to match for $key * @return \Cake\ORM\Query */ @@ -335,7 +341,7 @@ protected function _addFilteringCondition(Query $query, $key, $filter): Query * from $keys with the tuple values in $filter using the provided operator. * * @param \Cake\ORM\Query $query Target table's query - * @param string[] $keys the fields that should be used for filtering + * @param array $keys the fields that should be used for filtering * @param mixed $filter the value that should be used to match for $key * @param string $operator The operator for comparing the tuples * @return \Cake\Database\Expression\TupleComparison @@ -357,8 +363,8 @@ protected function _createTupleCondition(Query $query, array $keys, $filter, $op * Generates a string used as a table field that contains the values upon * which the filter should be applied * - * @param array $options The options for getting the link field. - * @return string|string[] + * @param array $options The options for getting the link field. + * @return array|string * @throws \RuntimeException */ protected function _linkField(array $options) @@ -404,7 +410,8 @@ protected function _buildSubquery(Query $query): Query $filterQuery->contain([], true); $filterQuery->setValueBinder(new ValueBinder()); - if (!$filterQuery->clause('limit')) { + // Ignore limit if there is no order since we need all rows to find matches + if (!$filterQuery->clause('limit') || !$filterQuery->clause('order')) { $filterQuery->limit(null); $filterQuery->order([], true); $filterQuery->offset(null); @@ -424,7 +431,7 @@ protected function _buildSubquery(Query $query): Query * that need to be present to ensure the correct association data is loaded. * * @param \Cake\ORM\Query $query The query to get fields from. - * @return array The list of fields for the subquery. + * @return array The list of fields for the subquery. */ protected function _subqueryFields(Query $query): array { @@ -455,8 +462,8 @@ protected function _subqueryFields(Query $query): array * the foreignKey value corresponding to this association. * * @param \Cake\ORM\Query $fetchQuery The query to get results from - * @param array $options The options passed to the eager loader - * @return array + * @param array $options The options passed to the eager loader + * @return array */ protected function _buildResultMap(Query $fetchQuery, array $options): array { @@ -487,9 +494,9 @@ protected function _buildResultMap(Query $fetchQuery, array $options): array * for injecting the eager loaded rows * * @param \Cake\ORM\Query $fetchQuery the Query used to fetch results - * @param array $resultMap an array with the foreignKey as keys and + * @param array $resultMap an array with the foreignKey as keys and * the corresponding target table results as value. - * @param array $options The options passed to the eagerLoader method + * @param array $options The options passed to the eagerLoader method * @return \Closure */ protected function _resultInjector(Query $fetchQuery, array $resultMap, array $options): Closure @@ -525,8 +532,8 @@ protected function _resultInjector(Query $fetchQuery, array $resultMap, array $o * for injecting the eager loaded rows when the matching needs to * be done with multiple foreign keys * - * @param array $resultMap A keyed arrays containing the target table - * @param string[] $sourceKeys An array with aliased keys to match + * @param array $resultMap A keyed arrays containing the target table + * @param array $sourceKeys An array with aliased keys to match * @param string $nestKey The key under which results should be nested * @return \Closure */ diff --git a/app/vendor/cakephp/cakephp/src/ORM/Association/Loader/SelectWithPivotLoader.php b/app/vendor/cakephp/cakephp/src/ORM/Association/Loader/SelectWithPivotLoader.php index 128f52f5..318a8e45 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Association/Loader/SelectWithPivotLoader.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Association/Loader/SelectWithPivotLoader.php @@ -50,7 +50,7 @@ class SelectWithPivotLoader extends SelectLoader /** * Custom conditions for the junction association * - * @var string|array|\Cake\Database\ExpressionInterface|\Closure|null + * @var \Cake\Database\ExpressionInterface|\Closure|array|string|null */ protected $junctionConditions; @@ -73,7 +73,7 @@ public function __construct(array $options) * * This is used for eager loading records on the target table based on conditions. * - * @param array $options options accepted by eagerLoader() + * @param array $options options accepted by eagerLoader() * @return \Cake\ORM\Query * @throws \InvalidArgumentException When a key is required for associations but not selected. */ @@ -141,8 +141,8 @@ protected function _assertFieldsPresent(Query $fetchQuery, array $key): void * Generates a string used as a table field that contains the values upon * which the filter should be applied * - * @param array $options the options to use for getting the link field. - * @return string|string[] + * @param array $options the options to use for getting the link field. + * @return array|string */ protected function _linkField(array $options) { @@ -165,8 +165,8 @@ protected function _linkField(array $options) * the foreignKey value corresponding to this association. * * @param \Cake\ORM\Query $fetchQuery The query to get results from - * @param array $options The options passed to the eager loader - * @return array + * @param array $options The options passed to the eager loader + * @return array * @throws \RuntimeException when the association property is not part of the results set. */ protected function _buildResultMap(Query $fetchQuery, array $options): array diff --git a/app/vendor/cakephp/cakephp/src/ORM/AssociationCollection.php b/app/vendor/cakephp/cakephp/src/ORM/AssociationCollection.php index 6a025dd3..f73f0592 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/AssociationCollection.php +++ b/app/vendor/cakephp/cakephp/src/ORM/AssociationCollection.php @@ -38,7 +38,7 @@ class AssociationCollection implements IteratorAggregate /** * Stored associations * - * @var \Cake\ORM\Association[] + * @var array<\Cake\ORM\Association> */ protected $_items = []; @@ -79,7 +79,7 @@ public function add(string $alias, Association $association): Association * * @param string $className The name of association class. * @param string $associated The alias for the target table. - * @param array $options List of options to configure the association definition. + * @param array $options List of options to configure the association definition. * @return \Cake\ORM\Association * @throws \InvalidArgumentException */ @@ -110,11 +110,7 @@ public function load(string $className, string $associated, array $options = []) */ public function get(string $alias): ?Association { - if (isset($this->_items[$alias])) { - return $this->_items[$alias]; - } - - return null; + return $this->_items[$alias] ?? null; } /** @@ -138,7 +134,7 @@ public function getByProperty(string $prop): ?Association * Check for an attached association by name. * * @param string $alias The association alias to get. - * @return bool Whether or not the association exists. + * @return bool Whether the association exists. */ public function has(string $alias): bool { @@ -148,7 +144,7 @@ public function has(string $alias): bool /** * Get the names of all the associations in the collection. * - * @return string[] + * @return array */ public function keys(): array { @@ -158,9 +154,9 @@ public function keys(): array /** * Get an array of associations matching a specific type. * - * @param string|array $class The type of associations you want. + * @param array|string $class The type of associations you want. * For example 'BelongsTo' or array like ['BelongsTo', 'HasOne'] - * @return \Cake\ORM\Association[] An array of Association objects. + * @return array<\Cake\ORM\Association> An array of Association objects. * @since 3.5.3 */ public function getByType($class): array @@ -179,7 +175,7 @@ public function getByType($class): array /** * Drop/remove an association. * - * Once removed the association will not longer be reachable + * Once removed the association will no longer be reachable * * @param string $alias The alias name. * @return void @@ -192,7 +188,7 @@ public function remove(string $alias): void /** * Remove all registered associations. * - * Once removed associations will not longer be reachable + * Once removed associations will no longer be reachable * * @return void */ @@ -213,7 +209,7 @@ public function removeAll(): void * @param \Cake\Datasource\EntityInterface $entity The entity to save associated data for. * @param array $associations The list of associations to save parents from. * associations not in this list will not be saved. - * @param array $options The options for the save operation. + * @param array $options The options for the save operation. * @return bool Success */ public function saveParents(Table $table, EntityInterface $entity, array $associations, array $options = []): bool @@ -235,7 +231,7 @@ public function saveParents(Table $table, EntityInterface $entity, array $associ * @param \Cake\Datasource\EntityInterface $entity The entity to save associated data for. * @param array $associations The list of associations to save children from. * associations not in this list will not be saved. - * @param array $options The options for the save operation. + * @param array $options The options for the save operation. * @return bool Success */ public function saveChildren(Table $table, EntityInterface $entity, array $associations, array $options): bool @@ -253,7 +249,7 @@ public function saveChildren(Table $table, EntityInterface $entity, array $assoc * @param \Cake\ORM\Table $table The table the save is currently operating on * @param \Cake\Datasource\EntityInterface $entity The entity to save * @param array $associations Array of associations to save. - * @param array $options Original options + * @param array $options Original options * @param bool $owningSide Compared with association classes' * isOwningSide method. * @return bool Success @@ -297,8 +293,8 @@ protected function _saveAssociations( * * @param \Cake\ORM\Association $association The association object to save with. * @param \Cake\Datasource\EntityInterface $entity The entity to save - * @param array $nested Options for deeper associations - * @param array $options Original options + * @param array $nested Options for deeper associations + * @param array $options Original options * @return bool Success */ protected function _save( @@ -322,7 +318,7 @@ protected function _save( * Cascade first across associations for which cascadeCallbacks is true. * * @param \Cake\Datasource\EntityInterface $entity The entity to delete associations for. - * @param array $options The options used in the delete operation. + * @param array $options The options used in the delete operation. * @return bool */ public function cascadeDelete(EntityInterface $entity, array $options): bool @@ -354,7 +350,7 @@ public function cascadeDelete(EntityInterface $entity, array $options): bool * array. If true is passed, then it returns all association names * in this collection. * - * @param bool|array $keys the list of association names to normalize + * @param array|bool $keys the list of association names to normalize * @return array */ public function normalizeKeys($keys): array @@ -373,8 +369,7 @@ public function normalizeKeys($keys): array /** * Allow looping through the associations * - * @return \Cake\ORM\Association[] - * @psalm-return \Traversable + * @return \Traversable */ public function getIterator(): Traversable { diff --git a/app/vendor/cakephp/cakephp/src/ORM/Behavior.php b/app/vendor/cakephp/cakephp/src/ORM/Behavior.php index 1f7939ab..31ab1f29 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Behavior.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Behavior.php @@ -46,7 +46,7 @@ * * ### Callback methods * - * Behaviors can listen to any events fired on a Table. By default + * Behaviors can listen to any events fired on a Table. By default, * CakePHP provides a number of lifecycle events your behaviors can * listen to: * @@ -54,7 +54,7 @@ * Fired before each find operation. By stopping the event and supplying a * return value you can bypass the find operation entirely. Any changes done * to the $query instance will be retained for the rest of the find. The - * $primary parameter indicates whether or not this is the root query, + * $primary parameter indicates whether this is the root query, * or an associated query. * * - `buildValidator(EventInterface $event, Validator $validator, string $name)` @@ -129,7 +129,7 @@ class Behavior implements EventListenerInterface * Stores the reflected method + finder methods per class. * This prevents reflecting the same class multiple times in a single process. * - * @var array + * @var array */ protected static $_reflectionCache = []; @@ -138,7 +138,7 @@ class Behavior implements EventListenerInterface * * These are merged with user-provided configuration when the behavior is used. * - * @var array + * @var array */ protected $_defaultConfig = []; @@ -148,7 +148,7 @@ class Behavior implements EventListenerInterface * Merges config with the default and store in the config property * * @param \Cake\ORM\Table $table The table this behavior is attached to. - * @param array $config The config for this behavior. + * @param array $config The config for this behavior. */ public function __construct(Table $table, array $config = []) { @@ -173,7 +173,7 @@ public function __construct(Table $table, array $config = []) * Implement this method to avoid having to overwrite * the constructor and call parent. * - * @param array $config The configuration settings provided to this behavior. + * @param array $config The configuration settings provided to this behavior. * @return void */ public function initialize(array $config): void @@ -207,8 +207,8 @@ public function table(): Table * Removes aliased methods that would otherwise be duplicated by userland configuration. * * @param string $key The key to filter. - * @param array $defaults The default method mappings. - * @param array $config The customized method mappings. + * @param array $defaults The default method mappings. + * @param array $config The customized method mappings. * @return array A de-duped list of config data. */ protected function _resolveMethodAliases(string $key, array $defaults, array $config): array @@ -273,7 +273,7 @@ public function verifyConfig(): void * Override this method if you need to add non-conventional event listeners. * Or if you want your behavior to listen to non-standard events. * - * @return array + * @return array */ public function implementedEvents(): array { diff --git a/app/vendor/cakephp/cakephp/src/ORM/Behavior/CounterCacheBehavior.php b/app/vendor/cakephp/cakephp/src/ORM/Behavior/CounterCacheBehavior.php index 68746fb0..ce851146 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Behavior/CounterCacheBehavior.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Behavior/CounterCacheBehavior.php @@ -106,7 +106,7 @@ class CounterCacheBehavior extends Behavior /** * Store the fields which should be ignored * - * @var array + * @var array> */ protected $_ignoreDirty = []; @@ -208,7 +208,7 @@ protected function _processAssociations(EventInterface $event, EntityInterface $ * @param \Cake\Event\EventInterface $event Event instance. * @param \Cake\Datasource\EntityInterface $entity Entity * @param \Cake\ORM\Association $assoc The association object - * @param array $settings The settings for for counter cache for this association + * @param array $settings The settings for counter cache for this association * @return void * @throws \RuntimeException If invalid callable is passed. */ @@ -289,7 +289,7 @@ protected function _shouldUpdateCount(array $conditions) /** * Fetches and returns the count for a single field in an association * - * @param array $config The counter cache configuration for a single field + * @param array $config The counter cache configuration for a single field * @param array $conditions Additional conditions given to the query * @return int The number of relations matching the given config and conditions */ @@ -301,10 +301,7 @@ protected function _getCount(array $config, array $conditions): int unset($config['finder']); } - if (!isset($config['conditions'])) { - $config['conditions'] = []; - } - $config['conditions'] = array_merge($conditions, $config['conditions']); + $config['conditions'] = array_merge($conditions, $config['conditions'] ?? []); $query = $this->_table->find($finder, $config); return $query->count(); diff --git a/app/vendor/cakephp/cakephp/src/ORM/Behavior/TimestampBehavior.php b/app/vendor/cakephp/cakephp/src/ORM/Behavior/TimestampBehavior.php index d2b6f7f8..57e3ec4e 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Behavior/TimestampBehavior.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Behavior/TimestampBehavior.php @@ -20,7 +20,7 @@ use Cake\Database\TypeFactory; use Cake\Datasource\EntityInterface; use Cake\Event\EventInterface; -use Cake\I18n\Time; +use Cake\I18n\FrozenTime; use Cake\ORM\Behavior; use DateTimeInterface; use RuntimeException; @@ -44,7 +44,7 @@ class TimestampBehavior extends Behavior * the code is executed, to set to an explicit date time value - set refreshTimetamp to false * and call setTimestamp() on the behavior class before use. * - * @var array + * @var array */ protected $_defaultConfig = [ 'implementedFinders' => [], @@ -64,7 +64,7 @@ class TimestampBehavior extends Behavior /** * Current timestamp * - * @var \Cake\I18n\Time|null + * @var \Cake\I18n\FrozenTime|null */ protected $_ts; @@ -74,7 +74,7 @@ class TimestampBehavior extends Behavior * If events are specified - do *not* merge them with existing events, * overwrite the events to listen on * - * @param array $config The config for this behavior. + * @param array $config The config for this behavior. * @return void */ public function initialize(array $config): void @@ -131,7 +131,7 @@ public function handleEvent(EventInterface $event, EntityInterface $entity): boo * * The implemented events of this behavior depend on configuration * - * @return array + * @return array */ public function implementedEvents(): array { @@ -147,7 +147,7 @@ public function implementedEvents(): array * * @param \DateTimeInterface|null $ts Timestamp * @param bool $refreshTimestamp If true timestamp is refreshed. - * @return \Cake\I18n\Time + * @return \Cake\I18n\FrozenTime */ public function timestamp(?DateTimeInterface $ts = null, bool $refreshTimestamp = false): DateTimeInterface { @@ -155,9 +155,9 @@ public function timestamp(?DateTimeInterface $ts = null, bool $refreshTimestamp if ($this->_config['refreshTimestamp']) { $this->_config['refreshTimestamp'] = false; } - $this->_ts = new Time($ts); + $this->_ts = new FrozenTime($ts); } elseif ($this->_ts === null || $refreshTimestamp) { - $this->_ts = new Time(); + $this->_ts = new FrozenTime(); } return $this->_ts; diff --git a/app/vendor/cakephp/cakephp/src/ORM/Behavior/Translate/EavStrategy.php b/app/vendor/cakephp/cakephp/src/ORM/Behavior/Translate/EavStrategy.php index 2a9f0e46..4b1e89ec 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Behavior/Translate/EavStrategy.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Behavior/Translate/EavStrategy.php @@ -52,7 +52,7 @@ class EavStrategy implements TranslateStrategyInterface * * These are merged with user-provided configuration. * - * @var array + * @var array */ protected $_defaultConfig = [ 'fields' => [], @@ -70,7 +70,7 @@ class EavStrategy implements TranslateStrategyInterface * Constructor * * @param \Cake\ORM\Table $table The table this strategy is attached to. - * @param array $config The config for this strategy. + * @param array $config The config for this strategy. */ public function __construct(Table $table, array $config = []) { diff --git a/app/vendor/cakephp/cakephp/src/ORM/Behavior/Translate/ShadowTableStrategy.php b/app/vendor/cakephp/cakephp/src/ORM/Behavior/Translate/ShadowTableStrategy.php index f1391aa5..328fbcbe 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Behavior/Translate/ShadowTableStrategy.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Behavior/Translate/ShadowTableStrategy.php @@ -45,7 +45,7 @@ class ShadowTableStrategy implements TranslateStrategyInterface * * These are merged with user-provided configuration. * - * @var array + * @var array */ protected $_defaultConfig = [ 'fields' => [], @@ -62,7 +62,7 @@ class ShadowTableStrategy implements TranslateStrategyInterface * Constructor * * @param \Cake\ORM\Table $table Table instance. - * @param array $config Configuration. + * @param array $config Configuration. */ public function __construct(Table $table, array $config = []) { @@ -135,7 +135,10 @@ public function beforeFind(EventInterface $event, Query $query, ArrayObject $opt $fieldsAdded = $this->addFieldsToQuery($query, $config); $orderByTranslatedField = $this->iterateClause($query, 'order', $config); - $filteredByTranslatedField = $this->traverseClause($query, 'where', $config); + $filteredByTranslatedField = + $this->traverseClause($query, 'where', $config) || + $config['onlyTranslated'] || + ($options['filterByCurrentLocale'] ?? null); if (!$fieldsAdded && !$orderByTranslatedField && !$filteredByTranslatedField) { return; @@ -199,7 +202,7 @@ protected function setupHasOneAssociation(string $locale, ArrayObject $options): * add the locale field though. * * @param \Cake\ORM\Query $query The query to check. - * @param array $config The config to use for adding fields. + * @param array $config The config to use for adding fields. * @return bool Whether a join to the translation table is required. */ protected function addFieldsToQuery($query, array $config) @@ -241,7 +244,7 @@ protected function addFieldsToQuery($query, array $config) * * @param \Cake\ORM\Query $query the query to check. * @param string $name The clause name. - * @param array $config The config to use for adding fields. + * @param array $config The config to use for adding fields. * @return bool Whether a join to the translation table is required. */ protected function iterateClause($query, $name = '', $config = []): bool @@ -287,7 +290,7 @@ function ($c, &$field) use ($fields, $alias, $mainTableAlias, $mainTableFields, * * @param \Cake\ORM\Query $query the query to check. * @param string $name The clause name. - * @param array $config The config to use for adding fields. + * @param array $config The config to use for adding fields. * @return bool Whether a join to the translation table is required. */ protected function traverseClause($query, $name = '', $config = []): bool diff --git a/app/vendor/cakephp/cakephp/src/ORM/Behavior/Translate/TranslateStrategyTrait.php b/app/vendor/cakephp/cakephp/src/ORM/Behavior/Translate/TranslateStrategyTrait.php index ea1fc290..bdfbb9b8 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Behavior/Translate/TranslateStrategyTrait.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Behavior/Translate/TranslateStrategyTrait.php @@ -106,7 +106,7 @@ public function getLocale(): string */ protected function unsetEmptyFields($entity) { - /** @var \Cake\ORM\Entity[] $translations */ + /** @var array<\Cake\ORM\Entity> $translations */ $translations = (array)$entity->get('_translations'); foreach ($translations as $locale => $translation) { $fields = $translation->extract($this->_config['fields'], false); @@ -141,7 +141,7 @@ protected function unsetEmptyFields($entity) * * @param \Cake\ORM\Marshaller $marshaller The marhshaller of the table the behavior is attached to. * @param array $map The property map being built. - * @param array $options The options array used in the marshalling call. + * @param array $options The options array used in the marshalling call. * @return array A map of `[property => callable]` of additional properties to marshal. */ public function buildMarshalMap(Marshaller $marshaller, array $map, array $options): array @@ -178,7 +178,7 @@ public function buildMarshalMap(Marshaller $marshaller, array $map, array $optio // Set errors into the root entity, so validation errors match the original form data position. if ($errors) { - $entity->setErrors($errors); + $entity->setErrors(['_translations' => $errors]); } return $translations; diff --git a/app/vendor/cakephp/cakephp/src/ORM/Behavior/Translate/TranslateTrait.php b/app/vendor/cakephp/cakephp/src/ORM/Behavior/Translate/TranslateTrait.php index 23670a31..95741243 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Behavior/Translate/TranslateTrait.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Behavior/Translate/TranslateTrait.php @@ -31,7 +31,7 @@ trait TranslateTrait * it. * * @param string $language Language to return entity for. - * @return $this|\Cake\Datasource\EntityInterface + * @return \Cake\Datasource\EntityInterface|$this */ public function translation(string $language) { diff --git a/app/vendor/cakephp/cakephp/src/ORM/Behavior/TranslateBehavior.php b/app/vendor/cakephp/cakephp/src/ORM/Behavior/TranslateBehavior.php index 5daecbb6..dc0df667 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Behavior/TranslateBehavior.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Behavior/TranslateBehavior.php @@ -45,7 +45,7 @@ class TranslateBehavior extends Behavior implements PropertyMarshalInterface * * These are merged with user-provided configuration when the behavior is used. * - * @var array + * @var array */ protected $_defaultConfig = [ 'implementedFinders' => ['translations' => 'findTranslations'], @@ -103,7 +103,7 @@ class TranslateBehavior extends Behavior implements PropertyMarshalInterface * are created/modified. Default `null`. * * @param \Cake\ORM\Table $table The table this behavior is attached to. - * @param array $config The config for this behavior. + * @param array $config The config for this behavior. */ public function __construct(Table $table, array $config = []) { @@ -119,7 +119,7 @@ public function __construct(Table $table, array $config = []) /** * Initialize hook * - * @param array $config The config for this behavior. + * @param array $config The config for this behavior. * @return void */ public function initialize(array $config): void @@ -202,7 +202,7 @@ public function setStrategy(TranslateStrategyInterface $strategy) /** * Gets the Model callbacks this behavior is interested in. * - * @return array + * @return array */ public function implementedEvents(): array { @@ -222,7 +222,7 @@ public function implementedEvents(): array * * @param \Cake\ORM\Marshaller $marshaller The marhshaller of the table the behavior is attached to. * @param array $map The property map being built. - * @param array $options The options array used in the marshalling call. + * @param array $options The options array used in the marshalling call. * @return array A map of `[property => callable]` of additional properties to marshal. */ public function buildMarshalMap(Marshaller $marshaller, array $map, array $options): array @@ -306,7 +306,7 @@ public function translationField(string $field): string * for each record. * * @param \Cake\ORM\Query $query The original query to modify - * @param array $options Options + * @param array $options Options * @return \Cake\ORM\Query */ public function findTranslations(Query $query, array $options): Query diff --git a/app/vendor/cakephp/cakephp/src/ORM/Behavior/TreeBehavior.php b/app/vendor/cakephp/cakephp/src/ORM/Behavior/TreeBehavior.php index af4f3282..154d10d2 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Behavior/TreeBehavior.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Behavior/TreeBehavior.php @@ -52,7 +52,7 @@ class TreeBehavior extends Behavior * * These are merged with user-provided configuration when the behavior is used. * - * @var array + * @var array */ protected $_defaultConfig = [ 'implementedFinders' => [ @@ -371,7 +371,7 @@ function ($exp) use ($config) { * is passed in the options containing the id of the node to get its path for. * * @param \Cake\ORM\Query $query The constructed query to modify - * @param array $options the list of options for the query + * @param array $options the list of options for the query * @return \Cake\ORM\Query * @throws \InvalidArgumentException If the 'for' key is missing in options */ @@ -435,7 +435,7 @@ public function childCount(EntityInterface $node, bool $direct = false): int * If the direct option is set to true, only the direct children are returned (based upon the parent_id field) * * @param \Cake\ORM\Query $query Query. - * @param array $options Array of options as described above + * @param array $options Array of options as described above * @return \Cake\ORM\Query * @throws \InvalidArgumentException When the 'for' key is not passed in $options */ @@ -487,7 +487,7 @@ function ($field) { * - spacer: A string to be used as prefix for denoting the depth in the tree for each item * * @param \Cake\ORM\Query $query Query. - * @param array $options Array of options as described above. + * @param array $options Array of options as described above. * @return \Cake\ORM\Query */ public function findTreeList(Query $query, array $options): Query @@ -517,7 +517,7 @@ public function findTreeList(Query $query, array $options): Query * - spacer: A string to be used as prefix for denoting the depth in the tree for each item. * * @param \Cake\ORM\Query $query The query object to format. - * @param array $options Array of options as described above. + * @param array $options Array of options as described above. * @return \Cake\ORM\Query Augmented query. */ public function formatTreeList(Query $query, array $options = []): Query @@ -601,12 +601,12 @@ protected function _removeFromTree(EntityInterface $node) * Reorders the node without changing its parent. * * If the node is the first child, or is a top level node with no previous node - * this method will return false + * this method will return the same node without any changes * * @param \Cake\Datasource\EntityInterface $node The node to move * @param int|true $number How many places to move the node, or true to move to first position * @throws \Cake\Datasource\Exception\RecordNotFoundException When node was not found - * @return \Cake\Datasource\EntityInterface|false $node The node after being moved or false on failure + * @return \Cake\Datasource\EntityInterface|false $node The node after being moved or false if `$number` is < 1 */ public function moveUp(EntityInterface $node, $number = 1) { @@ -626,7 +626,7 @@ public function moveUp(EntityInterface $node, $number = 1) * * @param \Cake\Datasource\EntityInterface $node The node to move * @param int|true $number How many places to move the node, or true to move to first position - * @return \Cake\Datasource\EntityInterface $node The node after being moved or false on failure + * @return \Cake\Datasource\EntityInterface $node The node after being moved * @throws \Cake\Datasource\Exception\RecordNotFoundException When node was not found */ protected function _moveUp(EntityInterface $node, $number): EntityInterface @@ -693,12 +693,12 @@ protected function _moveUp(EntityInterface $node, $number): EntityInterface * Reorders the node without changing the parent. * * If the node is the last child, or is a top level node with no subsequent node - * this method will return false + * this method will return the same node without any changes * * @param \Cake\Datasource\EntityInterface $node The node to move * @param int|true $number How many places to move the node or true to move to last position * @throws \Cake\Datasource\Exception\RecordNotFoundException When node was not found - * @return \Cake\Datasource\EntityInterface|false the entity after being moved or false on failure + * @return \Cake\Datasource\EntityInterface|false the entity after being moved or false if `$number` is < 1 */ public function moveDown(EntityInterface $node, $number = 1) { @@ -718,7 +718,7 @@ public function moveDown(EntityInterface $node, $number = 1) * * @param \Cake\Datasource\EntityInterface $node The node to move * @param int|true $number How many places to move the node, or true to move to last position - * @return \Cake\Datasource\EntityInterface $node The node after being moved or false on failure + * @return \Cake\Datasource\EntityInterface $node The node after being moved * @throws \Cake\Datasource\Exception\RecordNotFoundException When node was not found */ protected function _moveDown(EntityInterface $node, $number): EntityInterface @@ -828,47 +828,41 @@ public function recover(): void /** * Recursive method used to recover a single level of the tree * - * @param int $counter The Last left column value that was assigned + * @param int $lftRght The starting lft/rght value * @param mixed $parentId the parent id of the level to be recovered * @param int $level Node level - * @return int The next value to use for the left column + * @return int The next lftRght value */ - protected function _recoverTree(int $counter = 0, $parentId = null, $level = -1): int + protected function _recoverTree(int $lftRght = 1, $parentId = null, $level = 0): int { $config = $this->getConfig(); [$parent, $left, $right] = [$config['parent'], $config['left'], $config['right']]; $primaryKey = $this->_getPrimaryKey(); - $aliasedPrimaryKey = $this->_table->aliasField($primaryKey); - $order = $config['recoverOrder'] ?: $aliasedPrimaryKey; + $order = $config['recoverOrder'] ?: $primaryKey; - $query = $this->_scope($this->_table->query()) - ->select([$aliasedPrimaryKey]) - ->where([$this->_table->aliasField($parent) . ' IS' => $parentId]) + $nodes = $this->_scope($this->_table->query()) + ->select($primaryKey) + ->where([$parent . ' IS' => $parentId]) ->order($order) - ->disableHydration(); + ->disableHydration() + ->all(); - $leftCounter = $counter; - $nextLevel = $level + 1; - foreach ($query as $row) { - $counter++; - $counter = $this->_recoverTree($counter, $row[$primaryKey], $nextLevel); - } + foreach ($nodes as $node) { + $nodeLft = $lftRght++; + $lftRght = $this->_recoverTree($lftRght, $node[$primaryKey], $level + 1); - if ($parentId === null) { - return $counter; - } + $fields = [$left => $nodeLft, $right => $lftRght++]; + if ($config['level']) { + $fields[$config['level']] = $level; + } - $fields = [$left => $leftCounter, $right => $counter + 1]; - if ($config['level']) { - $fields[$config['level']] = $level; + $this->_table->updateAll( + $fields, + [$primaryKey => $node[$primaryKey]] + ); } - $this->_table->updateAll( - $fields, - [$primaryKey => $parentId] - ); - - return $counter + 1; + return $lftRght; } /** @@ -968,7 +962,7 @@ protected function _ensureFields(EntityInterface $entity): void return; } - $fresh = $this->_table->get($entity->get($this->_getPrimaryKey()), $fields); + $fresh = $this->_table->get($entity->get($this->_getPrimaryKey())); $entity->set($fresh->extract($fields), ['guard' => false]); foreach ($fields as $field) { @@ -994,7 +988,7 @@ protected function _getPrimaryKey(): string /** * Returns the depth level of a node in the tree. * - * @param int|string|\Cake\Datasource\EntityInterface $entity The entity or primary key get the level of. + * @param \Cake\Datasource\EntityInterface|string|int $entity The entity or primary key get the level of. * @return int|false Integer of the level or false if the node does not exist. */ public function getLevel($entity) diff --git a/app/vendor/cakephp/cakephp/src/ORM/BehaviorRegistry.php b/app/vendor/cakephp/cakephp/src/ORM/BehaviorRegistry.php index 7f7b2c2c..9afbb9a6 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/BehaviorRegistry.php +++ b/app/vendor/cakephp/cakephp/src/ORM/BehaviorRegistry.php @@ -135,7 +135,7 @@ protected function _throwMissingClassError(string $class, ?string $plugin): void * * @param string $class The classname that is missing. * @param string $alias The alias of the object. - * @param array $config An array of config to use for the behavior. + * @param array $config An array of config to use for the behavior. * @return \Cake\ORM\Behavior The constructed behavior class. * @psalm-suppress MoreSpecificImplementedParamType */ diff --git a/app/vendor/cakephp/cakephp/src/ORM/EagerLoadable.php b/app/vendor/cakephp/cakephp/src/ORM/EagerLoadable.php index c6e98c88..411f1ebb 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/EagerLoadable.php +++ b/app/vendor/cakephp/cakephp/src/ORM/EagerLoadable.php @@ -36,7 +36,7 @@ class EagerLoadable /** * A list of other associations to load from this level. * - * @var \Cake\ORM\EagerLoadable[] + * @var array<\Cake\ORM\EagerLoadable> */ protected $_associations = []; @@ -80,14 +80,14 @@ class EagerLoadable protected $_propertyPath; /** - * Whether or not this level can be fetched using a join. + * Whether this level can be fetched using a join. * * @var bool */ protected $_canBeJoined = false; /** - * Whether or not this level was meant for a "matching" fetch + * Whether this level was meant for a "matching" fetch * operation * * @var bool|null @@ -126,7 +126,7 @@ class EagerLoadable * The keys maps to the settable properties in this class. * * @param string $name The Association name. - * @param array $config The list of properties to set. + * @param array $config The list of properties to set. */ public function __construct(string $name, array $config = []) { @@ -157,7 +157,7 @@ public function addAssociation(string $name, EagerLoadable $association): void /** * Returns the Association class instance to use for loading the records. * - * @return \Cake\ORM\EagerLoadable[] + * @return array<\Cake\ORM\EagerLoadable> */ public function associations(): array { @@ -210,7 +210,7 @@ public function propertyPath(): ?string } /** - * Sets whether or not this level can be fetched using a join. + * Sets whether this level can be fetched using a join. * * @param bool $possible The value to set. * @return $this @@ -223,7 +223,7 @@ public function setCanBeJoined(bool $possible) } /** - * Gets whether or not this level can be fetched using a join. + * Gets whether this level can be fetched using a join. * * @return bool */ @@ -236,7 +236,7 @@ public function canBeJoined(): bool * Sets the list of options to pass to the association object for loading * the records. * - * @param array $config The value to set. + * @param array $config The value to set. * @return $this */ public function setConfig(array $config) @@ -258,7 +258,7 @@ public function getConfig(): array } /** - * Gets whether or not this level was meant for a + * Gets whether this level was meant for a * "matching" fetch operation. * * @return bool|null diff --git a/app/vendor/cakephp/cakephp/src/ORM/EagerLoader.php b/app/vendor/cakephp/cakephp/src/ORM/EagerLoader.php index 671acfa3..44412c04 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/EagerLoader.php +++ b/app/vendor/cakephp/cakephp/src/ORM/EagerLoader.php @@ -34,7 +34,7 @@ class EagerLoader * Nested array describing the association to be fetched * and the options to apply for each of them, if any * - * @var array + * @var array */ protected $_containments = []; @@ -42,7 +42,7 @@ class EagerLoader * Contains a nested array with the compiled containments tree * This is a normalized version of the user provided containments array. * - * @var \Cake\ORM\EagerLoadable[]|\Cake\ORM\EagerLoadable|null + * @var \Cake\ORM\EagerLoadable|array<\Cake\ORM\EagerLoadable>|null */ protected $_normalized; @@ -50,7 +50,7 @@ class EagerLoader * List of options accepted by associations in contain() * index by key for faster access * - * @var array + * @var array */ protected $_containOptions = [ 'associations' => 1, @@ -69,7 +69,7 @@ class EagerLoader /** * A list of associations that should be loaded with a separate query * - * @var \Cake\ORM\EagerLoadable[] + * @var array<\Cake\ORM\EagerLoadable> */ protected $_loadExternal = []; @@ -96,7 +96,7 @@ class EagerLoader protected $_joinsMap = []; /** - * Controls whether or not fields from associated tables + * Controls whether fields from associated tables * will be eagerly loaded. When set to false, no fields will * be loaded from associations. * @@ -137,7 +137,7 @@ public function contain($associations, ?callable $queryBuilder = null): array if ($queryBuilder) { if (!is_string($associations)) { throw new InvalidArgumentException( - sprintf('Cannot set containments. To use $queryBuilder, $associations must be a string') + 'Cannot set containments. To use $queryBuilder, $associations must be a string' ); } @@ -187,7 +187,7 @@ public function clearContain(): void } /** - * Sets whether or not contained associations will load fields automatically. + * Sets whether contained associations will load fields automatically. * * @param bool $enable The value to set. * @return $this @@ -212,7 +212,7 @@ public function disableAutoFields() } /** - * Gets whether or not contained associations will load fields automatically. + * Gets whether contained associations will load fields automatically. * * @return bool The current value. */ @@ -230,41 +230,37 @@ public function isAutoFieldsEnabled(): bool * * ### Options * - * - 'joinType': INNER, OUTER, ... - * - 'fields': Fields to contain + * - `joinType`: INNER, OUTER, ... + * - `fields`: Fields to contain + * - `negateMatch`: Whether to add conditions negate match on target association * - * @param string $assoc A single association or a dot separated path of associations. + * @param string $associationPath Dot separated association path, 'Name1.Name2.Name3' * @param callable|null $builder the callback function to be used for setting extra * options to the filtering query - * @param array $options Extra options for the association matching. + * @param array $options Extra options for the association matching. * @return $this */ - public function setMatching(string $assoc, ?callable $builder = null, array $options = []) + public function setMatching(string $associationPath, ?callable $builder = null, array $options = []) { if ($this->_matching === null) { $this->_matching = new static(); } - if (!isset($options['joinType'])) { - $options['joinType'] = Query::JOIN_TYPE_INNER; - } + $options += ['joinType' => Query::JOIN_TYPE_INNER]; + $sharedOptions = ['negateMatch' => false, 'matching' => true] + $options; - $assocs = explode('.', $assoc); - $last = array_pop($assocs); - $containments = []; - $pointer = &$containments; - $opts = ['matching' => true] + $options; - /** @psalm-suppress InvalidArrayOffset */ - unset($opts['negateMatch']); - - foreach ($assocs as $name) { - $pointer[$name] = $opts; - $pointer = &$pointer[$name]; + $contains = []; + $nested = &$contains; + foreach (explode('.', $associationPath) as $association) { + // Add contain to parent contain using association name as key + $nested[$association] = $sharedOptions; + // Set to next nested level + $nested = &$nested[$association]; } - $pointer[$last] = ['queryBuilder' => $builder, 'matching' => true] + $options; - - $this->_matching->contain($containments); + // Add all options to target association contain which is the last in nested chain + $nested = ['matching' => true, 'queryBuilder' => $builder] + $options; + $this->_matching->contain($contains); return $this; } @@ -288,11 +284,11 @@ public function getMatching(): array * loaded for a table. The normalized array will restructure the original array * by sorting all associations under one key and special options under another. * - * Each of the levels of the associations tree will converted to a Cake\ORM\EagerLoadable + * Each of the levels of the associations tree will be converted to a {@link \Cake\ORM\EagerLoadable} * object, that contains all the information required for the association objects * to load the information from the database. * - * Additionally it will set an 'instance' key per association containing the + * Additionally, it will set an 'instance' key per association containing the * association instance from the corresponding source table * * @param \Cake\ORM\Table $repository The table containing the association that @@ -442,7 +438,7 @@ public function attachAssociations(Query $query, Table $repository, bool $includ * * @param \Cake\ORM\Table $repository The table containing the associations to be * attached - * @return \Cake\ORM\EagerLoadable[] + * @return array<\Cake\ORM\EagerLoadable> */ public function attachableAssociations(Table $repository): array { @@ -456,11 +452,11 @@ public function attachableAssociations(Table $repository): array /** * Returns an array with the associations that need to be fetched using a - * separate query, each array value will contain a Cake\ORM\EagerLoadable object. + * separate query, each array value will contain a {@link \Cake\ORM\EagerLoadable} object. * * @param \Cake\ORM\Table $repository The table containing the associations * to be loaded - * @return \Cake\ORM\EagerLoadable[] + * @return array<\Cake\ORM\EagerLoadable> */ public function externalAssociations(Table $repository): array { @@ -479,8 +475,8 @@ public function externalAssociations(Table $repository): array * * @param \Cake\ORM\Table $parent owning side of the association * @param string $alias name of the association to be loaded - * @param array $options list of extra options to use for this association - * @param array $paths An array with two values, the first one is a list of dot + * @param array $options list of extra options to use for this association + * @param array $paths An array with two values, the first one is a list of dot * separated strings representing associations that lead to this `$alias` in the * chain of associations to be loaded. The second value is the path to follow in * entities' properties to fetch a record of the corresponding association. @@ -586,9 +582,9 @@ protected function _correctStrategy(EagerLoadable $loadable): void * Helper function used to compile a list of all associations that can be * joined in the query. * - * @param \Cake\ORM\EagerLoadable[] $associations list of associations from which to obtain joins. - * @param \Cake\ORM\EagerLoadable[] $matching list of associations that should be forcibly joined. - * @return \Cake\ORM\EagerLoadable[] + * @param array<\Cake\ORM\EagerLoadable> $associations list of associations from which to obtain joins. + * @param array<\Cake\ORM\EagerLoadable> $matching list of associations that should be forcibly joined. + * @return array<\Cake\ORM\EagerLoadable> */ protected function _resolveJoins(array $associations, array $matching = []): array { @@ -690,10 +686,10 @@ public function loadExternal(Query $query, StatementInterface $statement): State * * - alias: The association alias * - instance: The association instance - * - canBeJoined: Whether or not the association will be loaded using a JOIN + * - canBeJoined: Whether the association will be loaded using a JOIN * - entityClass: The entity that should be used for hydrating the results * - nestKey: A dotted path that can be used to correctly insert the data into the results. - * - matching: Whether or not it is an association loaded through `matching()`. + * - matching: Whether it is an association loaded through `matching()`. * * @param \Cake\ORM\Table $table The table containing the association that * will be normalized @@ -720,8 +716,8 @@ public function associationsMap(Table $table): array * associationsMap() method. * * @param array $map An initial array for the map. - * @param \Cake\ORM\EagerLoadable[] $level An array of EagerLoadable instances. - * @param bool $matching Whether or not it is an association loaded through `matching()`. + * @param array<\Cake\ORM\EagerLoadable> $level An array of EagerLoadable instances. + * @param bool $matching Whether it is an association loaded through `matching()`. * @return array */ protected function _buildAssociationsMap(array $map, array $level, bool $matching = false): array @@ -756,9 +752,9 @@ protected function _buildAssociationsMap(array $map, array $level, bool $matchin * @param string $alias The table alias as it appears in the query. * @param \Cake\ORM\Association $assoc The association object the alias represents; * will be normalized - * @param bool $asMatching Whether or not this join results should be treated as a + * @param bool $asMatching Whether this join results should be treated as a * 'matching' association. - * @param string $targetProperty The property name where the results of the join should be nested at. + * @param string|null $targetProperty The property name where the results of the join should be nested at. * If not passed, the default property for the association will be used. * @return void */ @@ -781,7 +777,7 @@ public function addToJoinsMap( * Helper function used to return the keys from the query records that will be used * to eagerly load associations. * - * @param \Cake\ORM\EagerLoadable[] $external the list of external associations to be loaded + * @param array<\Cake\ORM\EagerLoadable> $external the list of external associations to be loaded * @param \Cake\ORM\Query $query The query from which the results where generated * @param \Cake\Database\StatementInterface $statement The statement to work on * @return array @@ -823,7 +819,7 @@ protected function _collectKeys(array $external, Query $query, $statement): arra * defined in $collectKeys * * @param \Cake\Database\Statement\BufferedStatement $statement The statement to read from. - * @param array $collectKeys The keys to collect + * @param array $collectKeys The keys to collect * @return array */ protected function _groupKeys(BufferedStatement $statement, array $collectKeys): array diff --git a/app/vendor/cakephp/cakephp/src/ORM/Entity.php b/app/vendor/cakephp/cakephp/src/ORM/Entity.php index a7167875..14e5d57e 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Entity.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Entity.php @@ -44,8 +44,8 @@ class Entity implements EntityInterface, InvalidPropertyInterface * $entity = new Entity(['id' => 1, 'name' => 'Andrew']) * ``` * - * @param array $properties hash of properties to set in this entity - * @param array $options list of options to use when creating this entity + * @param array $properties hash of properties to set in this entity + * @param array $options list of options to use when creating this entity */ public function __construct(array $properties = [], array $options = []) { diff --git a/app/vendor/cakephp/cakephp/src/ORM/Exception/PersistenceFailedException.php b/app/vendor/cakephp/cakephp/src/ORM/Exception/PersistenceFailedException.php index 5d9d0302..291d8ced 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Exception/PersistenceFailedException.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Exception/PersistenceFailedException.php @@ -40,9 +40,9 @@ class PersistenceFailedException extends CakeException * Constructor. * * @param \Cake\Datasource\EntityInterface $entity The entity on which the persistence operation failed - * @param string|array $message Either the string of the error message, or an array of attributes + * @param array|string $message Either the string of the error message, or an array of attributes * that are made available in the view, and sprintf()'d into Exception::$_messageTemplate - * @param int $code The code of the error, is also the HTTP status code for the error. + * @param int|null $code The code of the error, is also the HTTP status code for the error. * @param \Throwable|null $previous the previous exception. */ public function __construct(EntityInterface $entity, $message, ?int $code = null, ?Throwable $previous = null) diff --git a/app/vendor/cakephp/cakephp/src/ORM/LazyEagerLoader.php b/app/vendor/cakephp/cakephp/src/ORM/LazyEagerLoader.php index cf2ddb55..2fd6cb9e 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/LazyEagerLoader.php +++ b/app/vendor/cakephp/cakephp/src/ORM/LazyEagerLoader.php @@ -36,11 +36,11 @@ class LazyEagerLoader * * The properties for the associations to be loaded will be overwritten on each entity. * - * @param \Cake\Datasource\EntityInterface|\Cake\Datasource\EntityInterface[] $entities a single entity or list of entities + * @param \Cake\Datasource\EntityInterface|array<\Cake\Datasource\EntityInterface> $entities a single entity or list of entities * @param array $contain A `contain()` compatible array. * @see \Cake\ORM\Query::contain() * @param \Cake\ORM\Table $source The table to use for fetching the top level entities - * @return \Cake\Datasource\EntityInterface|\Cake\Datasource\EntityInterface[] + * @return \Cake\Datasource\EntityInterface|array<\Cake\Datasource\EntityInterface> */ public function loadInto($entities, array $contain, Table $source) { @@ -116,8 +116,8 @@ protected function _getQuery(CollectionInterface $objects, array $contain, Table * in the top level entities. * * @param \Cake\ORM\Table $source The table having the top level associations - * @param string[] $associations The name of the top level associations - * @return string[] + * @param array $associations The name of the top level associations + * @return array */ protected function _getPropertyMap(Table $source, array $associations): array { @@ -135,9 +135,9 @@ protected function _getPropertyMap(Table $source, array $associations): array * Injects the results of the eager loader query into the original list of * entities. * - * @param \Cake\Datasource\EntityInterface[]|\Traversable $objects The original list of entities - * @param \Cake\Collection\CollectionInterface|\Cake\ORM\Query $results The loaded results - * @param string[] $associations The top level associations that were loaded + * @param \Traversable|array<\Cake\Datasource\EntityInterface> $objects The original list of entities + * @param \Cake\ORM\Query $results The loaded results + * @param array $associations The top level associations that were loaded * @param \Cake\ORM\Table $source The table where the entities came from * @return array */ @@ -147,6 +147,7 @@ protected function _injectResults(iterable $objects, $results, array $associatio $properties = $this->_getPropertyMap($source, $associations); $primaryKey = (array)$source->getPrimaryKey(); $results = $results + ->all() ->indexBy(function ($e) use ($primaryKey) { /** @var \Cake\Datasource\EntityInterface $e */ return implode(';', $e->extract($primaryKey)); diff --git a/app/vendor/cakephp/cakephp/src/ORM/Locator/LocatorAwareTrait.php b/app/vendor/cakephp/cakephp/src/ORM/Locator/LocatorAwareTrait.php index 3c17d437..15713052 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Locator/LocatorAwareTrait.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Locator/LocatorAwareTrait.php @@ -16,13 +16,22 @@ */ namespace Cake\ORM\Locator; +use Cake\Core\Exception\CakeException; use Cake\Datasource\FactoryLocator; +use Cake\ORM\Table; /** * Contains method for setting and accessing LocatorInterface instance */ trait LocatorAwareTrait { + /** + * This object's default table alias. + * + * @var string|null + */ + protected $defaultTable = null; + /** * Table locator instance * @@ -58,4 +67,26 @@ public function getTableLocator(): LocatorInterface /** @var \Cake\ORM\Locator\LocatorInterface */ return $this->_tableLocator; } + + /** + * Convenience method to get a table instance. + * + * @param string|null $alias The alias name you want to get. Should be in CamelCase format. + * If `null` then the value of $defaultTable property is used. + * @param array $options The options you want to build the table with. + * If a table has already been loaded the registry options will be ignored. + * @return \Cake\ORM\Table + * @throws \Cake\Core\Exception\CakeException If `$alias` argument and `$defaultTable` property both are `null`. + * @see \Cake\ORM\TableLocator::get() + * @since 4.3.0 + */ + public function fetchTable(?string $alias = null, array $options = []): Table + { + $alias = $alias ?? $this->defaultTable; + if ($alias === null) { + throw new CakeException('You must provide an `$alias` or set the `$defaultTable` property.'); + } + + return $this->getTableLocator()->get($alias, $options); + } } diff --git a/app/vendor/cakephp/cakephp/src/ORM/Locator/LocatorInterface.php b/app/vendor/cakephp/cakephp/src/ORM/Locator/LocatorInterface.php index 68db76d8..24516e8e 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Locator/LocatorInterface.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Locator/LocatorInterface.php @@ -16,13 +16,14 @@ */ namespace Cake\ORM\Locator; +use Cake\Datasource\Locator\LocatorInterface as BaseLocatorInterface; use Cake\Datasource\RepositoryInterface; use Cake\ORM\Table; /** * Registries for Table objects should implement this interface. */ -interface LocatorInterface extends \Cake\Datasource\Locator\LocatorInterface +interface LocatorInterface extends BaseLocatorInterface { /** * Returns configuration for an alias or the full configuration array for @@ -37,9 +38,9 @@ public function getConfig(?string $alias = null): array; * Stores a list of options to be used when instantiating an object * with a matching alias. * - * @param string|array $alias Name of the alias or array to completely + * @param array|string $alias Name of the alias or array to completely * overwrite current config. - * @param array|null $options list of options for the alias + * @param array|null $options list of options for the alias * @return $this * @throws \RuntimeException When you attempt to configure an existing * table instance. @@ -50,7 +51,7 @@ public function setConfig($alias, $options = null); * Get a table instance from the registry. * * @param string $alias The alias name you want to get. - * @param array $options The options you want to build the table with. + * @param array $options The options you want to build the table with. * @return \Cake\ORM\Table */ public function get(string $alias, array $options = []): Table; diff --git a/app/vendor/cakephp/cakephp/src/ORM/Locator/TableLocator.php b/app/vendor/cakephp/cakephp/src/ORM/Locator/TableLocator.php index a89d1401..7f9fd029 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Locator/TableLocator.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Locator/TableLocator.php @@ -34,14 +34,14 @@ class TableLocator extends AbstractLocator implements LocatorInterface /** * Contains a list of locations where table classes should be looked for. * - * @var array + * @var array */ protected $locations = []; /** * Configuration for aliases. * - * @var array + * @var array */ protected $_config = []; @@ -56,7 +56,7 @@ class TableLocator extends AbstractLocator implements LocatorInterface * Contains a list of Table objects that were created out of the * built-in Table class. The list is indexed by table alias * - * @var \Cake\ORM\Table[] + * @var array<\Cake\ORM\Table> */ protected $_fallbacked = []; @@ -78,7 +78,7 @@ class TableLocator extends AbstractLocator implements LocatorInterface /** * Constructor. * - * @param array|null $locations Locations where tables should be looked for. + * @param array|null $locations Locations where tables should be looked for. * If none provided, the default `Model\Table` under your app's namespace is used. */ public function __construct(?array $locations = null) @@ -171,7 +171,7 @@ public function getConfig(?string $alias = null): array * This is important because table associations are resolved at runtime * and cyclic references need to be handled correctly. * - * The options that can be passed are the same as in Cake\ORM\Table::__construct(), but the + * The options that can be passed are the same as in {@link \Cake\ORM\Table::__construct()}, but the * `className` key is also recognized. * * ### Options @@ -194,7 +194,7 @@ public function getConfig(?string $alias = null): array * the same alias, the registry will only store the first instance. * * @param string $alias The alias name you want to get. Should be in CamelCase format. - * @param array $options The options you want to build the table with. + * @param array $options The options you want to build the table with. * If a table has already been loaded the options will be ignored. * @return \Cake\ORM\Table * @throws \RuntimeException When you try to configure an alias that already exists. @@ -274,7 +274,7 @@ protected function createInstance(string $alias, array $options) * Gets the table class name. * * @param string $alias The alias name you want to get. Should be in CamelCase format. - * @param array $options Table options array. + * @param array $options Table options array. * @return string|null */ protected function _getClassName(string $alias, array $options = []): ?string @@ -300,7 +300,7 @@ protected function _getClassName(string $alias, array $options = []): ?string /** * Wrapper for creating table instances * - * @param array $options The alias to check for. + * @param array $options The alias to check for. * @return \Cake\ORM\Table */ protected function _create(array $options): Table @@ -339,7 +339,7 @@ public function clear(): void * debugging common mistakes when setting up associations or created new table * classes. * - * @return \Cake\ORM\Table[] + * @return array<\Cake\ORM\Table> */ public function genericInstances(): array { diff --git a/app/vendor/cakephp/cakephp/src/ORM/Marshaller.php b/app/vendor/cakephp/cakephp/src/ORM/Marshaller.php index f79d5569..6d52e7e1 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Marshaller.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Marshaller.php @@ -23,6 +23,7 @@ use Cake\Datasource\EntityInterface; use Cake\Datasource\InvalidPropertyInterface; use Cake\ORM\Association\BelongsToMany; +use Cake\Utility\Hash; use InvalidArgumentException; use RuntimeException; @@ -61,7 +62,7 @@ public function __construct(Table $table) * Build the map of property => marshalling callable. * * @param array $data The data being marshalled. - * @param array $options List of options containing the 'associated' key. + * @param array $options List of options containing the 'associated' key. * @throws \InvalidArgumentException When associations do not exist. * @return array */ @@ -82,9 +83,7 @@ protected function _buildPropertyMap(array $data, array $options): array } // Map associations - if (!isset($options['associated'])) { - $options['associated'] = []; - } + $options['associated'] = $options['associated'] ?? []; $include = $this->_normalizeAssociations($options['associated']); foreach ($include as $key => $nested) { if (is_int($key) && is_scalar($nested)) { @@ -170,7 +169,7 @@ protected function _buildPropertyMap(array $data, array $options): array * ``` * * @param array $data The data to hydrate. - * @param array $options List of options + * @param array $options List of options * @return \Cake\Datasource\EntityInterface * @see \Cake\ORM\Table::newEntity() * @see \Cake\ORM\Entity::$_accessible @@ -241,7 +240,7 @@ public function one(array $data, array $options = []): EntityInterface * Returns the validation errors for a data set based on the passed options * * @param array $data The data to validate. - * @param array $options The options passed to this marshaller. + * @param array $options The options passed to this marshaller. * @param bool $isNew Whether it is a new entity or one to be updated. * @return array The list of validation errors. * @throws \RuntimeException If no validator can be created. @@ -258,6 +257,11 @@ protected function _validate(array $data, array $options, bool $isNew): array } elseif (is_string($options['validate'])) { $validator = $this->_table->getValidator($options['validate']); } elseif (is_object($options['validate'])) { + deprecationWarning( + 'Passing validator instance for the `validate` option is deprecated,' + . ' use `ValidatorAwareTrait::setValidator() instead.`' + ); + /** @var \Cake\Validation\Validator $validator */ $validator = $options['validate']; } @@ -275,7 +279,7 @@ protected function _validate(array $data, array $options, bool $isNew): array * Returns data and options prepared to validate and marshall. * * @param array $data The data to prepare. - * @param array $options The options passed to this marshaller. + * @param array $options The options passed to this marshaller. * @return array An array containing prepared data and options. */ protected function _prepareDataAndOptions(array $data, array $options): array @@ -300,8 +304,8 @@ protected function _prepareDataAndOptions(array $data, array $options): array * * @param \Cake\ORM\Association $assoc The association to marshall * @param mixed $value The data to hydrate. If not an array, this method will return null. - * @param array $options List of options. - * @return \Cake\Datasource\EntityInterface|\Cake\Datasource\EntityInterface[]|null + * @param array $options List of options. + * @return \Cake\Datasource\EntityInterface|array<\Cake\Datasource\EntityInterface>|null */ protected function _marshalAssociation(Association $assoc, $value, array $options) { @@ -350,8 +354,8 @@ protected function _marshalAssociation(Association $assoc, $value, array $option * on missing entities would be ignored. Defaults to false. * * @param array $data The data to hydrate. - * @param array $options List of options - * @return \Cake\Datasource\EntityInterface[] An array of hydrated records. + * @param array $options List of options + * @return array<\Cake\Datasource\EntityInterface> An array of hydrated records. * @see \Cake\ORM\Table::newEntities() * @see \Cake\ORM\Entity::$_accessible */ @@ -376,8 +380,8 @@ public function many(array $data, array $options = []): array * * @param \Cake\ORM\Association\BelongsToMany $assoc The association to marshal. * @param array $data The data to convert into entities. - * @param array $options List of options. - * @return \Cake\Datasource\EntityInterface[] An array of built entities. + * @param array $options List of options. + * @return array<\Cake\Datasource\EntityInterface> An array of built entities. * @throws \BadMethodCallException * @throws \InvalidArgumentException * @throws \RuntimeException @@ -471,7 +475,7 @@ protected function _belongsToMany(BelongsToMany $assoc, array $data, array $opti * * @param \Cake\ORM\Association $assoc The association class for the belongsToMany association. * @param array $ids The list of ids to load. - * @return \Cake\Datasource\EntityInterface[] An array of entities. + * @return array<\Cake\Datasource\EntityInterface> An array of entities. */ protected function _loadAssociatedByIds(Association $assoc, array $ids): array { @@ -516,7 +520,7 @@ protected function _loadAssociatedByIds(Association $assoc, array $ids): array * ### Options: * * - associated: Associations listed here will be marshalled as well. - * - validate: Whether or not to validate data before hydrating the entities. Can + * - validate: Whether to validate data before hydrating the entities. Can * also be set to a string to use a specific validator. Defaults to true/default. * - fields: An allowed list of fields to be assigned to the entity. If not present * the accessible fields list in the entity will be used. @@ -535,7 +539,7 @@ protected function _loadAssociatedByIds(Association $assoc, array $ids): array * @param \Cake\Datasource\EntityInterface $entity the entity that will get the * data merged in * @param array $data key value list of fields to be merged into the entity - * @param array $options List of options. + * @param array $options List of options. * @return \Cake\Datasource\EntityInterface * @see \Cake\ORM\Entity::$_accessible */ @@ -642,7 +646,7 @@ public function merge(EntityInterface $entity, array $data, array $options = []) * * ### Options: * - * - validate: Whether or not to validate data before hydrating the entities. Can + * - validate: Whether to validate data before hydrating the entities. Can * also be set to a string to use a specific validator. Defaults to true/default. * - associated: Associations listed here will be marshalled as well. * - fields: An allowed list of fields to be assigned to the entity. If not present, @@ -652,8 +656,8 @@ public function merge(EntityInterface $entity, array $data, array $options = []) * @param iterable<\Cake\Datasource\EntityInterface> $entities the entities that will get the * data merged in * @param array $data list of arrays to be merged into the entities - * @param array $options List of options. - * @return \Cake\Datasource\EntityInterface[] + * @param array $options List of options. + * @return array<\Cake\Datasource\EntityInterface> * @see \Cake\ORM\Entity::$_accessible * @psalm-suppress NullArrayOffset */ @@ -675,10 +679,8 @@ public function mergeMany(iterable $entities, array $data, array $options = []): }) ->toArray(); - /** @psalm-suppress InvalidArrayOffset */ - $new = $indexed[null] ?? []; - /** @psalm-suppress InvalidArrayOffset */ - unset($indexed[null]); + $new = $indexed[''] ?? []; + unset($indexed['']); $output = []; foreach ($entities as $entity) { @@ -700,7 +702,7 @@ public function mergeMany(iterable $entities, array $data, array $options = []): return explode(';', (string)$key); }) ->filter(function ($keys) use ($primary) { - return count(array_filter($keys, 'strlen')) === count($primary); + return count(Hash::filter($keys)) === count($primary); }) ->reduce(function ($conditions, $keys) use ($primary) { $fields = array_map([$this->_table, 'aliasField'], $primary); @@ -733,11 +735,11 @@ public function mergeMany(iterable $entities, array $data, array $options = []): /** * Creates a new sub-marshaller and merges the associated data. * - * @param \Cake\Datasource\EntityInterface|\Cake\Datasource\EntityInterface[] $original The original entity + * @param \Cake\Datasource\EntityInterface|array<\Cake\Datasource\EntityInterface> $original The original entity * @param \Cake\ORM\Association $assoc The association to merge * @param mixed $value The array of data to hydrate. If not an array, this method will return null. - * @param array $options List of options. - * @return \Cake\Datasource\EntityInterface|\Cake\Datasource\EntityInterface[]|null + * @param array $options List of options. + * @return \Cake\Datasource\EntityInterface|array<\Cake\Datasource\EntityInterface>|null */ protected function _mergeAssociation($original, Association $assoc, $value, array $options) { @@ -780,11 +782,11 @@ protected function _mergeAssociation($original, Association $assoc, $value, arra * Creates a new sub-marshaller and merges the associated data for a BelongstoMany * association. * - * @param \Cake\Datasource\EntityInterface[] $original The original entities list. + * @param array<\Cake\Datasource\EntityInterface> $original The original entities list. * @param \Cake\ORM\Association\BelongsToMany $assoc The association to marshall * @param array $value The data to hydrate - * @param array $options List of options. - * @return \Cake\Datasource\EntityInterface[] + * @param array $options List of options. + * @return array<\Cake\Datasource\EntityInterface> */ protected function _mergeBelongsToMany(array $original, BelongsToMany $assoc, array $value, array $options): array { @@ -810,11 +812,11 @@ protected function _mergeBelongsToMany(array $original, BelongsToMany $assoc, ar /** * Merge the special _joinData property into the entity set. * - * @param \Cake\Datasource\EntityInterface[] $original The original entities list. + * @param array<\Cake\Datasource\EntityInterface> $original The original entities list. * @param \Cake\ORM\Association\BelongsToMany $assoc The association to marshall * @param array $value The data to hydrate - * @param array $options List of options. - * @return \Cake\Datasource\EntityInterface[] An array of entities + * @param array $options List of options. + * @return array<\Cake\Datasource\EntityInterface> An array of entities */ protected function _mergeJoinData(array $original, BelongsToMany $assoc, array $value, array $options): array { @@ -873,7 +875,7 @@ protected function _mergeJoinData(array $original, BelongsToMany $assoc, array $ * * @param \Cake\Datasource\EntityInterface $entity The entity that was marshaled. * @param array $data readOnly $data to use. - * @param array $options List of options that are readOnly. + * @param array $options List of options that are readOnly. * @return void */ protected function dispatchAfterMarshal(EntityInterface $entity, array $data, array $options = []): void diff --git a/app/vendor/cakephp/cakephp/src/ORM/PropertyMarshalInterface.php b/app/vendor/cakephp/cakephp/src/ORM/PropertyMarshalInterface.php index f52ce749..8317d9eb 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/PropertyMarshalInterface.php +++ b/app/vendor/cakephp/cakephp/src/ORM/PropertyMarshalInterface.php @@ -29,7 +29,7 @@ interface PropertyMarshalInterface * * @param \Cake\ORM\Marshaller $marshaller The marhshaller of the table the behavior is attached to. * @param array $map The property map being built. - * @param array $options The options array used in the marshalling call. + * @param array $options The options array used in the marshalling call. * @return array A map of `[property => callable]` of additional properties to marshal. */ public function buildMarshalMap(Marshaller $marshaller, array $map, array $options): array; diff --git a/app/vendor/cakephp/cakephp/src/ORM/Query.php b/app/vendor/cakephp/cakephp/src/ORM/Query.php index d7dba8ec..cdba19ae 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Query.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Query.php @@ -53,10 +53,10 @@ * @method \Cake\Collection\CollectionInterface extract($field) Extracts a single column from each row * @method mixed max($field) Returns the maximum value for a single column in all the results. * @method mixed min($field) Returns the minimum value for a single column in all the results. - * @method \Cake\Collection\CollectionInterface groupBy(string|callable $field) In-memory group all results by the value of a column. - * @method \Cake\Collection\CollectionInterface indexBy(string|callable $callback) Returns the results indexed by the value of a column. - * @method \Cake\Collection\CollectionInterface countBy(string|callable $field) Returns the number of unique values for a column - * @method float sumOf(string|callable $field) Returns the sum of all values for a single column + * @method \Cake\Collection\CollectionInterface groupBy(callable|string $field) In-memory group all results by the value of a column. + * @method \Cake\Collection\CollectionInterface indexBy(callable|string $callback) Returns the results indexed by the value of a column. + * @method \Cake\Collection\CollectionInterface countBy(callable|string $field) Returns the number of unique values for a column + * @method float sumOf(callable|string $field) Returns the sum of all values for a single column * @method \Cake\Collection\CollectionInterface shuffle() In-memory randomize the order the results are returned * @method \Cake\Collection\CollectionInterface sample(int $size = 10) In-memory shuffle the results and return a subset of them. * @method \Cake\Collection\CollectionInterface take(int $size = 1, int $from = 0) In-memory limit and offset for the query results. @@ -116,7 +116,7 @@ class Query extends DatabaseQuery implements JsonSerializable, QueryInterface protected $_hasFields; /** - * Tracks whether or not the original query should include + * Tracks whether the original query should include * fields from the top level table. * * @var bool|null @@ -220,7 +220,7 @@ public function __construct(Connection $connection, Table $table) * all the fields in the schema of the table or the association will be added to * the select clause. * - * @param array|\Cake\Database\ExpressionInterface|callable|string|\Cake\ORM\Table|\Cake\ORM\Association $fields Fields + * @param \Cake\Database\ExpressionInterface|\Cake\ORM\Table|\Cake\ORM\Association|callable|array|string $fields Fields * to be added to the list. * @param bool $overwrite whether to reset fields with passed list or not * @return $this @@ -250,7 +250,7 @@ public function select($fields = [], bool $overwrite = false) * pass overwrite boolean true which will reset the select clause removing all previous additions. * * @param \Cake\ORM\Table|\Cake\ORM\Association $table The table to use to get an array of columns - * @param string[] $excludedFields The un-aliased column names you do not want selected from $table + * @param array $excludedFields The un-aliased column names you do not want selected from $table * @param bool $overwrite Whether to reset/remove previous selected fields * @return $this * @throws \InvalidArgumentException If Association|Table is not passed in first argument @@ -492,8 +492,8 @@ public function clearContain() * * @param \Cake\ORM\Table $table The table instance to pluck associations from. * @param \Cake\Database\TypeMap $typeMap The typemap to check for columns in. - * This typemap is indirectly mutated via Cake\ORM\Query::addDefaultTypes() - * @param array $associations The nested tree of associations to walk. + * This typemap is indirectly mutated via {@link \Cake\ORM\Query::addDefaultTypes()} + * @param array $associations The nested tree of associations to walk. * @return void */ protected function _addAssociationsToTypeMap(Table $table, TypeMap $typeMap, array $associations): void @@ -823,7 +823,7 @@ public function notMatching(string $assoc, ?callable $builder = null) * $options = $query->getOptions(); * ``` * - * @param array $options The options to be applied + * @param array $options The options to be applied * @return $this * @see getOptions() */ @@ -1065,7 +1065,7 @@ public function isHydrationEnabled(): bool * * @param \Closure|string|false $key Either the cache key or a function to generate the cache key. * When using a function, this query instance will be supplied as an argument. - * @param string|\Cake\Cache\CacheEngine $config Either the name of the cache config to use, or + * @param \Cake\Cache\CacheEngine|string $config Either the name of the cache config to use, or * a cache config instance. * @return $this * @throws \RuntimeException When you attempt to cache a non-select query. @@ -1215,6 +1215,10 @@ protected function _addDefaultSelectTypes(): void $types = []; foreach ($select as $alias => $value) { + if ($value instanceof TypedResultInterface) { + $types[$alias] = $value->getReturnType(); + continue; + } if (isset($typeMap[$alias])) { $types[$alias] = $typeMap[$alias]; continue; @@ -1222,9 +1226,6 @@ protected function _addDefaultSelectTypes(): void if (is_string($value) && isset($typeMap[$value])) { $types[$alias] = $typeMap[$value]; } - if ($value instanceof TypedResultInterface) { - $types[$alias] = $value->getReturnType(); - } } $this->getSelectTypeMap()->addDefaults($types); } @@ -1233,7 +1234,7 @@ protected function _addDefaultSelectTypes(): void * {@inheritDoc} * * @param string $finder The finder method to use. - * @param array $options The options for the finder. + * @param array $options The options for the finder. * @return static Returns a modified query. * @psalm-suppress MoreSpecificReturnType */ @@ -1264,7 +1265,7 @@ protected function _dirty(): void * This changes the query type to be 'update'. * Can be combined with set() and where() methods to create update queries. * - * @param string|\Cake\Database\ExpressionInterface|null $table Unused parameter. + * @param \Cake\Database\ExpressionInterface|string|null $table Unused parameter. * @return $this */ public function update($table = null) @@ -1305,7 +1306,7 @@ public function delete(?string $table = null) * Can be combined with the where() method to create delete queries. * * @param array $columns The columns to insert into. - * @param array $types A map between columns & their datatypes. + * @param array $types A map between columns & their datatypes. * @return $this */ public function insert(array $columns, array $types = []) @@ -1382,7 +1383,7 @@ public function jsonSerialize(): ResultSetInterface } /** - * Sets whether or not the ORM should automatically append fields. + * Sets whether the ORM should automatically append fields. * * By default calling select() will disable auto-fields. You can re-enable * auto-fields with this method. @@ -1410,7 +1411,7 @@ public function disableAutoFields() } /** - * Gets whether or not the ORM should automatically append fields. + * Gets whether the ORM should automatically append fields. * * By default calling select() will disable auto-fields. You can re-enable * auto-fields with enableAutoFields(). diff --git a/app/vendor/cakephp/cakephp/src/ORM/ResultSet.php b/app/vendor/cakephp/cakephp/src/ORM/ResultSet.php index 147322b1..d81d6351 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/ResultSet.php +++ b/app/vendor/cakephp/cakephp/src/ORM/ResultSet.php @@ -51,7 +51,7 @@ class ResultSet implements ResultSetInterface /** * Last record fetched from the statement * - * @var array|object + * @var object|array */ protected $_current; @@ -103,7 +103,7 @@ class ResultSet implements ResultSetInterface /** * Results that have been fetched or hydrated into the results. * - * @var array|\SplFixedArray + * @var \SplFixedArray|array */ protected $_results = []; @@ -129,7 +129,7 @@ class ResultSet implements ResultSetInterface protected $_entityClass; /** - * Whether or not to buffer results fetched from the statement + * Whether to buffer results fetched from the statement * * @var bool */ @@ -182,8 +182,9 @@ public function __construct(Query $query, StatementInterface $statement) * * Part of Iterator interface. * - * @return array|object + * @return object|array */ + #[\ReturnTypeWillChange] public function current() { return $this->_current; @@ -275,7 +276,7 @@ public function valid(): bool * * This method will also close the underlying statement cursor. * - * @return array|object|null + * @return object|array|null */ public function first() { @@ -298,6 +299,16 @@ public function first() * @return string Serialized object */ public function serialize(): string + { + return serialize($this->__serialize()); + } + + /** + * Serializes a resultset. + * + * @return array + */ + public function __serialize(): array { if (!$this->_useBuffering) { $msg = 'You cannot serialize an un-buffered ResultSet. ' @@ -310,10 +321,10 @@ public function serialize(): string } if ($this->_results instanceof SplFixedArray) { - return serialize($this->_results->toArray()); + return $this->_results->toArray(); } - return serialize($this->_results); + return $this->_results; } /** @@ -326,8 +337,18 @@ public function serialize(): string */ public function unserialize($serialized) { - $results = (array)(unserialize($serialized) ?: []); - $this->_results = SplFixedArray::fromArray($results); + $this->__unserialize((array)(unserialize($serialized) ?: [])); + } + + /** + * Unserializes a resultset. + * + * @param array $data Data array. + * @return void + */ + public function __unserialize(array $data): void + { + $this->_results = SplFixedArray::fromArray($data); $this->_useBuffering = true; $this->_count = $this->_results->count(); } @@ -435,7 +456,7 @@ protected function _fetchResult() * Correctly nests results keys including those coming from associations * * @param array $row Array containing columns and values or false if there is no results - * @return array|\Cake\Datasource\EntityInterface Results + * @return \Cake\Datasource\EntityInterface|array Results */ protected function _groupResult(array $row) { @@ -472,9 +493,7 @@ protected function _groupResult(array $row) // If the default table is not in the results, set // it to an empty array so that any contained // associations hydrate correctly. - if (!isset($results[$defaultAlias])) { - $results[$defaultAlias] = []; - } + $results[$defaultAlias] = $results[$defaultAlias] ?? []; unset($presentAliases[$defaultAlias]); diff --git a/app/vendor/cakephp/cakephp/src/ORM/Rule/ExistsIn.php b/app/vendor/cakephp/cakephp/src/ORM/Rule/ExistsIn.php index 6494b2a5..912c7199 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Rule/ExistsIn.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Rule/ExistsIn.php @@ -30,7 +30,7 @@ class ExistsIn /** * The list of fields to check * - * @var array + * @var array */ protected $_fields; @@ -44,7 +44,7 @@ class ExistsIn /** * Options for the constructor * - * @var array + * @var array */ protected $_options = []; @@ -54,10 +54,10 @@ class ExistsIn * Available option for $options is 'allowNullableNulls' flag. * Set to true to accept composite foreign keys where one or more nullable columns are null. * - * @param string|array $fields The field or fields to check existence as primary key. + * @param array|string $fields The field or fields to check existence as primary key. * @param \Cake\ORM\Table|\Cake\ORM\Association|string $repository The repository where the * field will be looked for, or the association name for the repository. - * @param array $options The options that modify the rules behavior. + * @param array $options The options that modify the rule's behavior. * Options 'allowNullableNulls' will make the rule pass if given foreign keys are set to `null`. * Notice: allowNullableNulls cannot pass by database columns set to `NOT NULL`. */ @@ -74,7 +74,7 @@ public function __construct($fields, $repository, array $options = []) * Performs the existence check * * @param \Cake\Datasource\EntityInterface $entity The entity from where to extract the fields - * @param array $options Options passed to the check, + * @param array $options Options passed to the check, * where the `repository` key is required. * @throws \RuntimeException When the rule refers to an undefined association. * @return bool @@ -147,7 +147,7 @@ function ($key) use ($target) { } /** - * Checks whether or not the given entity fields are nullable and null. + * Checks whether the given entity fields are nullable and null. * * @param \Cake\Datasource\EntityInterface $entity The entity to check. * @param \Cake\ORM\Table $source The table to use schema from. diff --git a/app/vendor/cakephp/cakephp/src/ORM/Rule/IsUnique.php b/app/vendor/cakephp/cakephp/src/ORM/Rule/IsUnique.php index 24cfeae0..f06f5140 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Rule/IsUnique.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Rule/IsUnique.php @@ -17,6 +17,7 @@ namespace Cake\ORM\Rule; use Cake\Datasource\EntityInterface; +use Cake\Utility\Hash; /** * Checks that a list of fields from an entity are unique in the table @@ -26,14 +27,14 @@ class IsUnique /** * The list of fields to check * - * @var string[] + * @var array */ protected $_fields; /** * The unique check options * - * @var array + * @var array */ protected $_options = [ 'allowMultipleNulls' => false, @@ -46,8 +47,8 @@ class IsUnique * * - `allowMultipleNulls` Allows any field to have multiple null values. Defaults to false. * - * @param string[] $fields The list of fields to check uniqueness for - * @param array $options The options for unique checks. + * @param array $fields The list of fields to check uniqueness for + * @param array $options The options for unique checks. */ public function __construct(array $fields, array $options = []) { @@ -60,7 +61,7 @@ public function __construct(array $fields, array $options = []) * * @param \Cake\Datasource\EntityInterface $entity The entity from where to extract the fields * where the `repository` key is required. - * @param array $options Options passed to the check, + * @param array $options Options passed to the check, * @return bool */ public function __invoke(EntityInterface $entity, array $options): bool @@ -79,7 +80,7 @@ public function __invoke(EntityInterface $entity, array $options): bool if ($entity->isNew() === false) { $keys = (array)$options['repository']->getPrimaryKey(); $keys = $this->_alias($alias, $entity->extract($keys)); - if (array_filter($keys, 'strlen')) { + if (Hash::filter($keys)) { $conditions['NOT'] = $keys; } } diff --git a/app/vendor/cakephp/cakephp/src/ORM/Rule/LinkConstraint.php b/app/vendor/cakephp/cakephp/src/ORM/Rule/LinkConstraint.php index 6a25ba23..37fbdf7d 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Rule/LinkConstraint.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Rule/LinkConstraint.php @@ -88,7 +88,7 @@ public function __construct($association, string $requiredLinkStatus) * Performs the actual link check. * * @param \Cake\Datasource\EntityInterface $entity The entity involved in the operation. - * @param array $options Options passed from the rules checker. + * @param array $options Options passed from the rules checker. * @return bool Whether the check was successful. */ public function __invoke(EntityInterface $entity, array $options): bool @@ -126,9 +126,9 @@ public function __invoke(EntityInterface $entity, array $options): bool /** * Alias fields. * - * @param array $fields The fields that should be aliased. + * @param array $fields The fields that should be aliased. * @param \Cake\ORM\Table $source The object to use for aliasing. - * @return array The aliased fields + * @return array The aliased fields */ protected function _aliasFields(array $fields, Table $source): array { diff --git a/app/vendor/cakephp/cakephp/src/ORM/Rule/ValidCount.php b/app/vendor/cakephp/cakephp/src/ORM/Rule/ValidCount.php index f7e23521..89d18d03 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Rule/ValidCount.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Rule/ValidCount.php @@ -46,7 +46,7 @@ public function __construct(string $field) * Performs the count check * * @param \Cake\Datasource\EntityInterface $entity The entity from where to extract the fields. - * @param array $options Options passed to the check. + * @param array $options Options passed to the check. * @return bool True if successful, else false. */ public function __invoke(EntityInterface $entity, array $options): bool diff --git a/app/vendor/cakephp/cakephp/src/ORM/RulesChecker.php b/app/vendor/cakephp/cakephp/src/ORM/RulesChecker.php index 56184322..8136b6d8 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/RulesChecker.php +++ b/app/vendor/cakephp/cakephp/src/ORM/RulesChecker.php @@ -47,8 +47,8 @@ class RulesChecker extends BaseRulesChecker * * - `allowMultipleNulls` Allows any field to have multiple null values. Defaults to false. * - * @param string[] $fields The list of fields to check for uniqueness. - * @param string|array|null $message The error message to show in case the rule does not pass. Can + * @param array $fields The list of fields to check for uniqueness. + * @param array|string|null $message The error message to show in case the rule does not pass. Can * also be an array of options. When an array, the 'message' key can be used to provide a message. * @return \Cake\Datasource\RuleInvoker */ @@ -89,10 +89,10 @@ public function isUnique(array $fields, $message = null): RuleInvoker * 'message' sets a custom error message. * Set 'allowNullableNulls' to true to accept composite foreign keys where one or more nullable columns are null. * - * @param string|string[] $field The field or list of fields to check for existence by + * @param array|string $field The field or list of fields to check for existence by * primary key lookup in the other table. * @param \Cake\ORM\Table|\Cake\ORM\Association|string $table The table name where the fields existence will be checked. - * @param string|array|null $message The error message to show in case the rule does not pass. Can + * @param array|string|null $message The error message to show in case the rule does not pass. Can * also be an array of options. When an array, the 'message' key can be used to provide a message. * @return \Cake\Datasource\RuleInvoker */ diff --git a/app/vendor/cakephp/cakephp/src/ORM/SaveOptionsBuilder.php b/app/vendor/cakephp/cakephp/src/ORM/SaveOptionsBuilder.php index 12270d58..96023d0f 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/SaveOptionsBuilder.php +++ b/app/vendor/cakephp/cakephp/src/ORM/SaveOptionsBuilder.php @@ -49,7 +49,7 @@ class SaveOptionsBuilder extends ArrayObject * Constructor. * * @param \Cake\ORM\Table $table A table instance. - * @param array $options Options to parse when instantiating. + * @param array $options Options to parse when instantiating. */ public function __construct(Table $table, array $options = []) { @@ -80,7 +80,7 @@ public function parseArrayOptions(array $array) /** * Set associated options. * - * @param string|array $associated String or array of associations. + * @param array|string $associated String or array of associations. * @return $this */ public function associated($associated) diff --git a/app/vendor/cakephp/cakephp/src/ORM/Table.php b/app/vendor/cakephp/cakephp/src/ORM/Table.php index bc837d5b..859eff21 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/Table.php +++ b/app/vendor/cakephp/cakephp/src/ORM/Table.php @@ -89,7 +89,7 @@ * - `Model.beforeFind` Fired before each find operation. By stopping the event and * supplying a return value you can bypass the find operation entirely. Any * changes done to the $query instance will be retained for the rest of the find. The - * `$primary` parameter indicates whether or not this is the root query, or an + * `$primary` parameter indicates whether this is the root query, or an * associated query. * * - `Model.buildValidator` Allows listeners to modify validation rules @@ -214,14 +214,14 @@ class Table implements RepositoryInterface, EventListenerInterface, EventDispatc /** * The name of the field that represents the primary key in the table * - * @var string|string[]|null + * @var array|string|null */ protected $_primaryKey; /** - * The name of the field that represents a human readable representation of a row + * The name of the field that represents a human-readable representation of a row * - * @var string|string[]|null + * @var array|string|null */ protected $_displayField; @@ -273,7 +273,7 @@ class Table implements RepositoryInterface, EventListenerInterface, EventDispatc * validation set, or an associative array, where key is the name of the * validation set and value the Validator instance. * - * @param array $config List of options for this table + * @param array $config List of options for this table */ public function __construct(array $config = []) { @@ -353,7 +353,7 @@ public static function defaultConnectionName(): string * } * ``` * - * @param array $config Configuration options passed to the constructor + * @param array $config Configuration options passed to the constructor * @return void */ public function initialize(array $config): void @@ -526,7 +526,7 @@ public function getSchema(): TableSchemaInterface * If an array is passed, a new TableSchemaInterface will be constructed * out of it and used as the schema for this table. * - * @param array|\Cake\Database\Schema\TableSchemaInterface $schema Schema to be used for this table + * @param \Cake\Database\Schema\TableSchemaInterface|array $schema Schema to be used for this table * @return $this */ public function setSchema($schema) @@ -632,7 +632,7 @@ public function hasField(string $field): bool /** * Sets the primary key field name. * - * @param string|string[] $key Sets a new name to be used as primary key + * @param array|string $key Sets a new name to be used as primary key * @return $this */ public function setPrimaryKey($key) @@ -645,7 +645,7 @@ public function setPrimaryKey($key) /** * Returns the primary key field name. * - * @return string|string[] + * @return array|string */ public function getPrimaryKey() { @@ -663,7 +663,7 @@ public function getPrimaryKey() /** * Sets the display field. * - * @param string|string[] $field Name to be used as display field. + * @param array|string $field Name to be used as display field. * @return $this */ public function setDisplayField($field) @@ -676,19 +676,18 @@ public function setDisplayField($field) /** * Returns the display field. * - * @return string|string[]|null + * @return array|string|null */ public function getDisplayField() { if ($this->_displayField === null) { $schema = $this->getSchema(); - $primary = (array)$this->getPrimaryKey(); - $this->_displayField = array_shift($primary); - if ($schema->getColumn('title')) { - $this->_displayField = 'title'; - } - if ($schema->getColumn('name')) { - $this->_displayField = 'name'; + $this->_displayField = $this->getPrimaryKey(); + foreach (['title', 'name', 'label'] as $field) { + if ($schema->hasColumn($field)) { + $this->_displayField = $field; + break; + } } } @@ -769,7 +768,7 @@ public function setEntityClass(string $name) * Behaviors are generally loaded during Table::initialize(). * * @param string $name The name of the behavior. Can be a short class reference. - * @param array $options The options for the behavior to use. + * @param array $options The options for the behavior to use. * @return $this * @throws \RuntimeException If a behavior is being reloaded. * @see \Cake\ORM\Behavior @@ -793,7 +792,7 @@ public function addBehavior(string $name, array $options = []) * ]); * ``` * - * @param array $behaviors All of the behaviors to load. + * @param array $behaviors All the behaviors to load. * @return $this * @throws \RuntimeException If a behavior is being reloaded. */ @@ -869,7 +868,7 @@ public function getBehavior(string $name): Behavior * Check if a behavior with the given alias has been loaded. * * @param string $name The behavior alias to check. - * @return bool Whether or not the behavior exists. + * @return bool Whether the behavior exists. */ public function hasBehavior(string $name): bool { @@ -1036,7 +1035,7 @@ public function addAssociations(array $params) * * @param string $associated the alias for the target table. This is used to * uniquely identify the association - * @param array $options list of options to configure the association definition + * @param array $options list of options to configure the association definition * @return \Cake\ORM\Association\BelongsTo */ public function belongsTo(string $associated, array $options = []): BelongsTo @@ -1082,7 +1081,7 @@ public function belongsTo(string $associated, array $options = []): BelongsTo * * @param string $associated the alias for the target table. This is used to * uniquely identify the association - * @param array $options list of options to configure the association definition + * @param array $options list of options to configure the association definition * @return \Cake\ORM\Association\HasOne */ public function hasOne(string $associated, array $options = []): HasOne @@ -1134,7 +1133,7 @@ public function hasOne(string $associated, array $options = []): HasOne * * @param string $associated the alias for the target table. This is used to * uniquely identify the association - * @param array $options list of options to configure the association definition + * @param array $options list of options to configure the association definition * @return \Cake\ORM\Association\HasMany */ public function hasMany(string $associated, array $options = []): HasMany @@ -1188,7 +1187,7 @@ public function hasMany(string $associated, array $options = []): HasMany * * @param string $associated the alias for the target table. This is used to * uniquely identify the association - * @param array $options list of options to configure the association definition + * @param array $options list of options to configure the association definition * @return \Cake\ORM\Association\BelongsToMany */ public function belongsToMany(string $associated, array $options = []): BelongsToMany @@ -1256,15 +1255,12 @@ public function belongsToMany(string $associated, array $options = []): BelongsT * Would invoke the `findPublished` method. * * @param string $type the type of query to perform - * @param array $options An array that will be passed to Query::applyOptions() + * @param array $options An array that will be passed to Query::applyOptions() * @return \Cake\ORM\Query The query builder */ public function find(string $type = 'all', array $options = []): Query { - $query = $this->query(); - $query->select(); - - return $this->callFinder($type, $query, $options); + return $this->callFinder($type, $this->query()->select(), $options); } /** @@ -1274,7 +1270,7 @@ public function find(string $type = 'all', array $options = []): Query * can override this method in subclasses to modify how `find('all')` works. * * @param \Cake\ORM\Query $query The query to find with - * @param array $options The options to use for the find + * @param array $options The options to use for the find * @return \Cake\ORM\Query The query builder */ public function findAll(Query $query, array $options): Query @@ -1288,7 +1284,7 @@ public function findAll(Query $query, array $options): Query * * When calling this finder, the fields passed are used to determine what should * be used as the array key, value and optionally what to group the results by. - * By default the primary key for the model is used for the key, and the display + * By default, the primary key for the model is used for the key, and the display * field as value. * * The results of this finder will be in the following form: @@ -1313,7 +1309,7 @@ public function findAll(Query $query, array $options): Query * ``` * * The `valueField` can also be an array, in which case you can also specify - * the `valueSeparator` option to control how the values will be concatinated: + * the `valueSeparator` option to control how the values will be concatenated: * * ``` * $table->find('list', [ @@ -1355,7 +1351,7 @@ public function findAll(Query $query, array $options): Query * ``` * * @param \Cake\ORM\Query $query The query to find with - * @param array $options The options for the find + * @param array $options The options for the find * @return \Cake\ORM\Query The query builder */ public function findList(Query $query, array $options): Query @@ -1414,13 +1410,13 @@ public function findList(Query $query, array $options): Query * ``` * $table->find('threaded', [ * 'keyField' => 'id', - * 'parentField' => 'ancestor_id' + * 'parentField' => 'ancestor_id', * 'nestingKey' => 'children' * ]); * ``` * * @param \Cake\ORM\Query $query The query to find with - * @param array $options The options to find with + * @param array $options The options to find with * @return \Cake\ORM\Query The query builder */ public function findThreaded(Query $query, array $options): Query @@ -1447,8 +1443,8 @@ public function findThreaded(Query $query, array $options): Query * This is an auxiliary function used for result formatters that can accept * composite keys when comparing values. * - * @param array $options the original options passed to a finder - * @param string[] $keys the keys to check in $options to build matchers from + * @param array $options the original options passed to a finder + * @param array $keys the keys to check in $options to build matchers from * the associated value * @return array */ @@ -1491,7 +1487,7 @@ protected function _setFieldMatchers(array $options, array $keys): array * ``` * * @param mixed $primaryKey primary key value to find - * @param array $options options accepted by `Table::find()` + * @param array $options options accepted by `Table::find()` * @return \Cake\Datasource\EntityInterface * @throws \Cake\Datasource\Exception\RecordNotFoundException if the record with such id * could not be found @@ -1532,7 +1528,7 @@ public function get($primaryKey, array $options = []): EntityInterface if ($cacheConfig) { if (!$cacheKey) { $cacheKey = sprintf( - 'get:%s.%s%s', + 'get-%s-%s-%s', $this->getConnection()->configName(), $this->getTable(), json_encode($primaryKey) @@ -1599,13 +1595,13 @@ protected function _transactionCommitted(bool $atomic, bool $primary): bool * transaction (default: true) * - defaults: Whether to use the search criteria as default values for the new entity (default: true) * - * @param array|callable|\Cake\ORM\Query $search The criteria to find existing + * @param \Cake\ORM\Query|callable|array $search The criteria to find existing * records by. Note that when you pass a query object you'll have to use * the 2nd arg of the method to modify the entity data before saving. * @param callable|null $callback A callback that will be invoked for newly * created entities. This callback will be called *before* the entity * is persisted. - * @param array $options The options to use when saving. + * @param array $options The options to use when saving. * @return \Cake\Datasource\EntityInterface An entity. * @throws \Cake\ORM\Exception\PersistenceFailedException When the entity couldn't be saved */ @@ -1630,12 +1626,12 @@ public function findOrCreate($search, ?callable $callback = null, $options = []) /** * Performs the actual find and/or create of an entity based on the passed options. * - * @param array|callable|\Cake\ORM\Query $search The criteria to find an existing record by, or a callable tha will + * @param \Cake\ORM\Query|callable|array $search The criteria to find an existing record by, or a callable tha will * customize the find query. * @param callable|null $callback A callback that will be invoked for newly * created entities. This callback will be called *before* the entity * is persisted. - * @param array $options The options to use when saving. + * @param array $options The options to use when saving. * @return \Cake\Datasource\EntityInterface|array An entity. * @throws \Cake\ORM\Exception\PersistenceFailedException When the entity couldn't be saved * @throws \InvalidArgumentException @@ -1671,7 +1667,7 @@ protected function _processFindOrCreate($search, ?callable $callback = null, $op /** * Gets the query object for findOrCreate(). * - * @param array|callable|\Cake\ORM\Query $search The criteria to find existing records by. + * @param \Cake\ORM\Query|callable|array $search The criteria to find existing records by. * @return \Cake\ORM\Query */ protected function _getFindOrCreateQuery($search): Query @@ -1719,11 +1715,11 @@ public function subquery(): Query */ public function updateAll($fields, $conditions): int { - $query = $this->query(); - $query->update() + $statement = $this->query() + ->update() ->set($fields) - ->where($conditions); - $statement = $query->execute(); + ->where($conditions) + ->execute(); $statement->closeCursor(); return $statement->rowCount(); @@ -1734,10 +1730,10 @@ public function updateAll($fields, $conditions): int */ public function deleteAll($conditions): int { - $query = $this->query() + $statement = $this->query() ->delete() - ->where($conditions); - $statement = $query->execute(); + ->where($conditions) + ->execute(); $statement->closeCursor(); return $statement->rowCount(); @@ -1767,7 +1763,7 @@ public function exists($conditions): bool * * - atomic: Whether to execute the save and callbacks inside a database * transaction (default: true) - * - checkRules: Whether or not to check the rules on entity before saving, if the checking + * - checkRules: Whether to check the rules on entity before saving, if the checking * fails, it will abort the save operation. (default:true) * - associated: If `true` it will save 1st level associated entities as they are found * in the passed `$entity` whenever the property defined for the association @@ -1775,7 +1771,7 @@ public function exists($conditions): bool * to be saved. It is possible to provide different options for saving on associated * table objects using this key by making the custom options the array value. * If `false` no associated records will be saved. (default: `true`) - * - checkExisting: Whether or not to check if the entity already exists, assuming that the + * - checkExisting: Whether to check if the entity already exists, assuming that the * entity is marked as not new, and the primary key has been set. * * ### Events @@ -1840,7 +1836,7 @@ public function exists($conditions): bool * ``` * * @param \Cake\Datasource\EntityInterface $entity the entity to be saved - * @param array|\ArrayAccess|\Cake\ORM\SaveOptionsBuilder $options The options to use when saving. + * @param \Cake\ORM\SaveOptionsBuilder|\ArrayAccess|array $options The options to use when saving. * @return \Cake\Datasource\EntityInterface|false * @throws \Cake\ORM\Exception\RolledbackTransactionException If the transaction is aborted in the afterSave event. */ @@ -1889,7 +1885,7 @@ public function save(EntityInterface $entity, $options = []) * the entity contains errors or the save was aborted by a callback. * * @param \Cake\Datasource\EntityInterface $entity the entity to be saved - * @param array|\ArrayAccess $options The options to use when saving. + * @param \ArrayAccess|array $options The options to use when saving. * @return \Cake\Datasource\EntityInterface * @throws \Cake\ORM\Exception\PersistenceFailedException When the entity couldn't be saved * @see \Cake\ORM\Table::save() @@ -2067,15 +2063,15 @@ protected function _insert(EntityInterface $entity, array $data) } } - $success = false; if (empty($data)) { - return $success; + return false; } $statement = $this->query()->insert(array_keys($data)) ->values($data) ->execute(); + $success = false; if ($statement->rowCount() !== 0) { $success = $entity; $entity->set($filteredKeys, ['guard' => false]); @@ -2106,7 +2102,7 @@ protected function _insert(EntityInterface $entity, array $data) * Note: The ORM will not generate primary key values for composite primary keys. * You can overwrite _newId() in your table class. * - * @param string[] $primary The primary key columns to get a new ID for. + * @param array $primary The primary key columns to get a new ID for. * @return string|null Either null or the primary key value or a list of primary key values. */ protected function _newId(array $primary) @@ -2152,16 +2148,13 @@ protected function _update(EntityInterface $entity, array $data) throw new InvalidArgumentException($message); } - $query = $this->query(); - $statement = $query->update() + $statement = $this->query() + ->update() ->set($data) ->where($primaryKey) ->execute(); - $success = false; - if ($statement->errorCode() === '00000') { - $success = $entity; - } + $success = $statement->errorCode() === '00000' ? $entity : false; $statement->closeCursor(); return $success; @@ -2174,9 +2167,9 @@ protected function _update(EntityInterface $entity, array $data) * any one of the records fails to save due to failed validation or database * error. * - * @param array<\Cake\Datasource\EntityInterface>|\Cake\Datasource\ResultSetInterface $entities Entities to save. - * @param array|\ArrayAccess|\Cake\ORM\SaveOptionsBuilder $options Options used when calling Table::save() for each entity. - * @return array<\Cake\Datasource\EntityInterface>|\Cake\Datasource\ResultSetInterface|false False on failure, entities list on success. + * @param \Cake\Datasource\ResultSetInterface|array<\Cake\Datasource\EntityInterface> $entities Entities to save. + * @param \Cake\ORM\SaveOptionsBuilder|\ArrayAccess|array $options Options used when calling Table::save() for each entity. + * @return \Cake\Datasource\ResultSetInterface|array<\Cake\Datasource\EntityInterface>|false False on failure, entities list on success. * @throws \Exception */ public function saveMany(iterable $entities, $options = []) @@ -2195,9 +2188,9 @@ public function saveMany(iterable $entities, $options = []) * any one of the records fails to save due to failed validation or database * error. * - * @param array<\Cake\Datasource\EntityInterface>|\Cake\Datasource\ResultSetInterface $entities Entities to save. - * @param array|\ArrayAccess $options Options used when calling Table::save() for each entity. - * @return array<\Cake\Datasource\EntityInterface>|\Cake\Datasource\ResultSetInterface Entities list. + * @param \Cake\Datasource\ResultSetInterface|array<\Cake\Datasource\EntityInterface> $entities Entities to save. + * @param \ArrayAccess|array $options Options used when calling Table::save() for each entity. + * @return \Cake\Datasource\ResultSetInterface|array<\Cake\Datasource\EntityInterface> Entities list. * @throws \Exception * @throws \Cake\ORM\Exception\PersistenceFailedException If an entity couldn't be saved. */ @@ -2207,11 +2200,11 @@ public function saveManyOrFail(iterable $entities, $options = []): iterable } /** - * @param array<\Cake\Datasource\EntityInterface>|\Cake\Datasource\ResultSetInterface $entities Entities to save. - * @param array|\ArrayAccess|\Cake\ORM\SaveOptionsBuilder $options Options used when calling Table::save() for each entity. + * @param \Cake\Datasource\ResultSetInterface|array<\Cake\Datasource\EntityInterface> $entities Entities to save. + * @param \Cake\ORM\SaveOptionsBuilder|\ArrayAccess|array $options Options used when calling Table::save() for each entity. * @throws \Cake\ORM\Exception\PersistenceFailedException If an entity couldn't be saved. * @throws \Exception If an entity couldn't be saved. - * @return array<\Cake\Datasource\EntityInterface>|\Cake\Datasource\ResultSetInterface Entities list. + * @return \Cake\Datasource\ResultSetInterface|array<\Cake\Datasource\EntityInterface> Entities list. */ protected function _saveMany(iterable $entities, $options = []): iterable { @@ -2223,7 +2216,7 @@ protected function _saveMany(iterable $entities, $options = []): iterable ] ); - /** @var bool[] $isNew */ + /** @var array $isNew */ $isNew = []; $cleanup = function ($entities) use (&$isNew): void { /** @var array<\Cake\Datasource\EntityInterface> $entities */ @@ -2297,7 +2290,7 @@ protected function _saveMany(iterable $entities, $options = []): iterable * the options used in the delete operation. * * @param \Cake\Datasource\EntityInterface $entity The entity to remove. - * @param array|\ArrayAccess $options The options for the delete. + * @param \ArrayAccess|array $options The options for the delete. * @return bool success */ public function delete(EntityInterface $entity, $options = []): bool @@ -2329,9 +2322,9 @@ public function delete(EntityInterface $entity, $options = []): bool * any one of the records fails to delete due to failed validation or database * error. * - * @param array<\Cake\Datasource\EntityInterface>|\Cake\Datasource\ResultSetInterface $entities Entities to delete. - * @param array|\ArrayAccess $options Options used when calling Table::save() for each entity. - * @return array<\Cake\Datasource\EntityInterface>|\Cake\Datasource\ResultSetInterface|false Entities list + * @param \Cake\Datasource\ResultSetInterface|array<\Cake\Datasource\EntityInterface> $entities Entities to delete. + * @param \ArrayAccess|array $options Options used when calling Table::save() for each entity. + * @return \Cake\Datasource\ResultSetInterface|array<\Cake\Datasource\EntityInterface>|false Entities list * on success, false on failure. * @see \Cake\ORM\Table::delete() for options and events related to this method. */ @@ -2353,9 +2346,9 @@ public function deleteMany(iterable $entities, $options = []) * any one of the records fails to delete due to failed validation or database * error. * - * @param array<\Cake\Datasource\EntityInterface>|\Cake\Datasource\ResultSetInterface $entities Entities to delete. - * @param array|\ArrayAccess $options Options used when calling Table::save() for each entity. - * @return array<\Cake\Datasource\EntityInterface>|\Cake\Datasource\ResultSetInterface Entities list. + * @param \Cake\Datasource\ResultSetInterface|array<\Cake\Datasource\EntityInterface> $entities Entities to delete. + * @param \ArrayAccess|array $options Options used when calling Table::save() for each entity. + * @return \Cake\Datasource\ResultSetInterface|array<\Cake\Datasource\EntityInterface> Entities list. * @throws \Cake\ORM\Exception\PersistenceFailedException * @see \Cake\ORM\Table::delete() for options and events related to this method. */ @@ -2371,8 +2364,8 @@ public function deleteManyOrFail(iterable $entities, $options = []): iterable } /** - * @param array<\Cake\Datasource\EntityInterface>|\Cake\Datasource\ResultSetInterface $entities Entities to delete. - * @param array|\ArrayAccess $options Options used. + * @param \Cake\Datasource\ResultSetInterface|array<\Cake\Datasource\EntityInterface> $entities Entities to delete. + * @param \ArrayAccess|array $options Options used. * @return \Cake\Datasource\EntityInterface|null */ protected function _deleteMany(iterable $entities, $options = []): ?EntityInterface @@ -2410,7 +2403,7 @@ protected function _deleteMany(iterable $entities, $options = []): ?EntityInterf * has no primary key value, application rules checks failed or the delete was aborted by a callback. * * @param \Cake\Datasource\EntityInterface $entity The entity to remove. - * @param array|\ArrayAccess $options The options for the delete. + * @param \ArrayAccess|array $options The options for the delete. * @return true * @throws \Cake\ORM\Exception\PersistenceFailedException * @see \Cake\ORM\Table::delete() @@ -2470,15 +2463,13 @@ protected function _processDelete(EntityInterface $entity, ArrayObject $options) return $success; } - $query = $this->query(); - $conditions = $entity->extract($primaryKey); - $statement = $query->delete() - ->where($conditions) + $statement = $this->query() + ->delete() + ->where($entity->extract($primaryKey)) ->execute(); - $success = $statement->rowCount() > 0; - if (!$success) { - return $success; + if ($statement->rowCount() < 1) { + return false; } $this->dispatchEvent('Model.afterDelete', [ @@ -2486,7 +2477,7 @@ protected function _processDelete(EntityInterface $entity, ArrayObject $options) 'options' => $options, ]); - return $success; + return true; } /** @@ -2503,14 +2494,16 @@ public function hasFinder(string $type): bool } /** - * Calls a finder method directly and applies it to the passed query, - * if no query is passed a new one will be created and returned + * Calls a finder method and applies it to the passed query. * - * @param string $type name of the finder to be called - * @param \Cake\ORM\Query $query The query object to apply the finder options to - * @param array $options List of options to pass to the finder + * @param string $type Name of the finder to be called. + * @param \Cake\ORM\Query $query The query object to apply the finder options to. + * @param array $options List of options to pass to the finder. * @return \Cake\ORM\Query * @throws \BadMethodCallException + * @uses findAll() + * @uses findList() + * @uses findThreaded() */ public function callFinder(string $type, Query $query, array $options = []): Query { @@ -2737,15 +2730,13 @@ public function newEmptyEntity(): EntityInterface * before it is converted into entities. * * @param array $data The data to build an entity with. - * @param array $options A list of options for the object hydration. + * @param array $options A list of options for the object hydration. * @return \Cake\Datasource\EntityInterface * @see \Cake\ORM\Marshaller::one() */ public function newEntity(array $data, array $options = []): EntityInterface { - if (!isset($options['associated'])) { - $options['associated'] = $this->_associations->keys(); - } + $options['associated'] = $options['associated'] ?? $this->_associations->keys(); $marshaller = $this->marshaller(); return $marshaller->one($data, $options); @@ -2780,14 +2771,12 @@ public function newEntity(array $data, array $options = []): EntityInterface * before it is converted into entities. * * @param array $data The data to build an entity with. - * @param array $options A list of options for the objects hydration. + * @param array $options A list of options for the objects hydration. * @return array<\Cake\Datasource\EntityInterface> An array of hydrated records. */ public function newEntities(array $data, array $options = []): array { - if (!isset($options['associated'])) { - $options['associated'] = $this->_associations->keys(); - } + $options['associated'] = $options['associated'] ?? $this->_associations->keys(); $marshaller = $this->marshaller(); return $marshaller->many($data, $options); @@ -2840,15 +2829,13 @@ public function newEntities(array $data, array $options = []): array * @param \Cake\Datasource\EntityInterface $entity the entity that will get the * data merged in * @param array $data key value list of fields to be merged into the entity - * @param array $options A list of options for the object hydration. + * @param array $options A list of options for the object hydration. * @return \Cake\Datasource\EntityInterface * @see \Cake\ORM\Marshaller::merge() */ public function patchEntity(EntityInterface $entity, array $data, array $options = []): EntityInterface { - if (!isset($options['associated'])) { - $options['associated'] = $this->_associations->keys(); - } + $options['associated'] = $options['associated'] ?? $this->_associations->keys(); $marshaller = $this->marshaller(); return $marshaller->merge($entity, $data, $options); @@ -2879,17 +2866,15 @@ public function patchEntity(EntityInterface $entity, array $data, array $options * You can use the `Model.beforeMarshal` event to modify request data * before it is converted into entities. * - * @param array<\Cake\Datasource\EntityInterface>|\Traversable $entities the entities that will get the + * @param \Traversable|array<\Cake\Datasource\EntityInterface> $entities the entities that will get the * data merged in * @param array $data list of arrays to be merged into the entities - * @param array $options A list of options for the objects hydration. + * @param array $options A list of options for the objects hydration. * @return array<\Cake\Datasource\EntityInterface> */ public function patchEntities(iterable $entities, array $data, array $options = []): array { - if (!isset($options['associated'])) { - $options['associated'] = $this->_associations->keys(); - } + $options['associated'] = $options['associated'] ?? $this->_associations->keys(); $marshaller = $this->marshaller(); return $marshaller->mergeMany($entities, $data, $options); @@ -2924,7 +2909,7 @@ public function patchEntities(iterable $entities, array $data, array $options = * the data to be validated. * * @param mixed $value The value of column to be checked for uniqueness. - * @param array $options The options array, optionally containing the 'scope' key. + * @param array $options The options array, optionally containing the 'scope' key. * May also be the validation context, if there are no options. * @param array|null $context Either the validation context or null. * @return bool True if the value is unique, or false if a non-scalar, non-unique value was given. @@ -2983,7 +2968,7 @@ public function validateUnique($value, array $options, ?array $context = null): * - Model.beforeRules => beforeRules * - Model.afterRules => afterRules * - * @return array + * @return array */ public function implementedEvents(): array { @@ -3027,7 +3012,7 @@ public function buildRules(RulesChecker $rules): RulesChecker /** * Gets a SaveOptionsBuilder instance. * - * @param array $options Options to parse by the builder. + * @param array $options Options to parse by the builder. * @return \Cake\ORM\SaveOptionsBuilder */ public function getSaveOptionsBuilder(array $options = []): SaveOptionsBuilder diff --git a/app/vendor/cakephp/cakephp/src/ORM/TableRegistry.php b/app/vendor/cakephp/cakephp/src/ORM/TableRegistry.php index 52a0c42a..7119be7d 100644 --- a/app/vendor/cakephp/cakephp/src/ORM/TableRegistry.php +++ b/app/vendor/cakephp/cakephp/src/ORM/TableRegistry.php @@ -86,9 +86,9 @@ public static function setTableLocator(LocatorInterface $tableLocator): void * See options specification in {@link TableLocator::get()}. * * @param string $alias The alias name you want to get. - * @param array $options The options you want to build the table with. + * @param array $options The options you want to build the table with. * @return \Cake\ORM\Table - * @deprecated 3.6.0 Use {@link \Cake\ORM\Locator\TableLocator::get()} instead. Will be removed in 5.0. + * @deprecated 3.6.0 Use {@link \Cake\ORM\Locator\LocatorAwareTrait::fetchTable()} instead. Will be removed in 5.0. */ public static function get(string $alias, array $options = []): Table { diff --git a/app/vendor/cakephp/cakephp/src/Routing/Asset.php b/app/vendor/cakephp/cakephp/src/Routing/Asset.php index 2e5e1215..88dee894 100644 --- a/app/vendor/cakephp/cakephp/src/Routing/Asset.php +++ b/app/vendor/cakephp/cakephp/src/Routing/Asset.php @@ -51,7 +51,7 @@ public static function setInflectionType(string $inflectionType): void * `Asset::assetTimestamp()` to add timestamp to local files. * * @param string $path Path string. - * @param array $options Options array. Possible keys: + * @param array $options Options array. Possible keys: * `fullBase` Return full URL with domain name * `pathPrefix` Path prefix for relative URLs * `plugin` False value will prevent parsing path as a plugin @@ -75,7 +75,7 @@ public static function imageUrl(string $path, array $options = []): string * `Asset::assetTimestamp()` to add timestamp to local files. * * @param string $path Path string. - * @param array $options Options array. Possible keys: + * @param array $options Options array. Possible keys: * `fullBase` Return full URL with domain name * `pathPrefix` Path prefix for relative URLs * `ext` Asset extension to append @@ -101,7 +101,7 @@ public static function cssUrl(string $path, array $options = []): string * `Asset::assetTimestamp()` to add timestamp to local files. * * @param string $path Path string. - * @param array $options Options array. Possible keys: + * @param array $options Options array. Possible keys: * `fullBase` Return full URL with domain name * `pathPrefix` Path prefix for relative URLs * `ext` Asset extension to append @@ -140,7 +140,7 @@ public static function scriptUrl(string $path, array $options = []): string * enable timestamping regardless of debug value. * * @param string $path Path string or URL array - * @param array $options Options array. + * @param array $options Options array. * @return string Generated URL */ public static function url(string $path, array $options = []): string @@ -231,7 +231,7 @@ protected static function encodeUrl(string $url): string * a timestamp will be added. * * @param string $path The file path to timestamp, the path must be inside `App.wwwRoot` in Configure. - * @param bool|string $timestamp If set will overrule the value of `Asset.timestamp` in Configure. + * @param string|bool $timestamp If set will overrule the value of `Asset.timestamp` in Configure. * @return string Path with a timestamp added, or not. */ public static function assetTimestamp(string $path, $timestamp = null): string @@ -284,7 +284,7 @@ public static function assetTimestamp(string $path, $timestamp = null): string * - `theme` Optional theme name * * @param string $file The file to create a webroot path to. - * @param array $options Options array. + * @param array $options Options array. * @return string Web accessible path to file. */ public static function webroot(string $file, array $options = []): string diff --git a/app/vendor/cakephp/cakephp/src/Routing/Exception/DuplicateNamedRouteException.php b/app/vendor/cakephp/cakephp/src/Routing/Exception/DuplicateNamedRouteException.php index 4bff190d..d4ccf220 100644 --- a/app/vendor/cakephp/cakephp/src/Routing/Exception/DuplicateNamedRouteException.php +++ b/app/vendor/cakephp/cakephp/src/Routing/Exception/DuplicateNamedRouteException.php @@ -30,7 +30,7 @@ class DuplicateNamedRouteException extends CakeException /** * Constructor. * - * @param string|array $message Either the string of the error message, or an array of attributes + * @param array|string $message Either the string of the error message, or an array of attributes * that are made available in the view, and sprintf()'d into Exception::$_messageTemplate * @param int|null $code The code of the error, is also the HTTP status code for the error. Defaults to 404. * @param \Throwable|null $previous the previous exception. diff --git a/app/vendor/cakephp/cakephp/src/Routing/Exception/MissingControllerException.php b/app/vendor/cakephp/cakephp/src/Routing/Exception/MissingControllerException.php index e6456fea..9cd4351c 100644 --- a/app/vendor/cakephp/cakephp/src/Routing/Exception/MissingControllerException.php +++ b/app/vendor/cakephp/cakephp/src/Routing/Exception/MissingControllerException.php @@ -6,5 +6,6 @@ class_alias( 'Cake\Routing\Exception\MissingControllerException' ); deprecationWarning( - 'Use Cake\Http\Exception\MissingControllerException instead of Cake\Routing\Exception\MissingControllerException.' + 'Use Cake\Http\Exception\MissingControllerException instead of Cake\Routing\Exception\MissingControllerException.', + 0 ); diff --git a/app/vendor/cakephp/cakephp/src/Routing/Exception/MissingRouteException.php b/app/vendor/cakephp/cakephp/src/Routing/Exception/MissingRouteException.php index b731c61b..ce88be3e 100644 --- a/app/vendor/cakephp/cakephp/src/Routing/Exception/MissingRouteException.php +++ b/app/vendor/cakephp/cakephp/src/Routing/Exception/MissingRouteException.php @@ -38,7 +38,7 @@ class MissingRouteException extends CakeException /** * Constructor. * - * @param string|array $message Either the string of the error message, or an array of attributes + * @param array|string $message Either the string of the error message, or an array of attributes * that are made available in the view, and sprintf()'d into Exception::$_messageTemplate * @param int|null $code The code of the error, is also the HTTP status code for the error. Defaults to 404. * @param \Throwable|null $previous the previous exception. diff --git a/app/vendor/cakephp/cakephp/src/Routing/Exception/RedirectException.php b/app/vendor/cakephp/cakephp/src/Routing/Exception/RedirectException.php index ff1beffd..ef1d1e1b 100644 --- a/app/vendor/cakephp/cakephp/src/Routing/Exception/RedirectException.php +++ b/app/vendor/cakephp/cakephp/src/Routing/Exception/RedirectException.php @@ -29,9 +29,9 @@ * ``` * * If you need a more general purpose redirect exception use - * Cake\Http\Exception\RedirectException instead of this class. + * {@link \Cake\Http\Exception\RedirectException} instead of this class. * - * @deprecated 4.1.0 Use Cake\Http\Exception\RedirectException instead. + * @deprecated 4.1.0 Use {@link \Cake\Http\Exception\RedirectException} instead. */ class RedirectException extends CakeException { diff --git a/app/vendor/cakephp/cakephp/src/Routing/Middleware/AssetMiddleware.php b/app/vendor/cakephp/cakephp/src/Routing/Middleware/AssetMiddleware.php index 0eb2aee5..ccff26eb 100644 --- a/app/vendor/cakephp/cakephp/src/Routing/Middleware/AssetMiddleware.php +++ b/app/vendor/cakephp/cakephp/src/Routing/Middleware/AssetMiddleware.php @@ -45,7 +45,7 @@ class AssetMiddleware implements MiddlewareInterface /** * Constructor. * - * @param array $options The options to use + * @param array $options The options to use */ public function __construct(array $options = []) { diff --git a/app/vendor/cakephp/cakephp/src/Routing/Route/DashedRoute.php b/app/vendor/cakephp/cakephp/src/Routing/Route/DashedRoute.php index 8a0fb138..2444e402 100644 --- a/app/vendor/cakephp/cakephp/src/Routing/Route/DashedRoute.php +++ b/app/vendor/cakephp/cakephp/src/Routing/Route/DashedRoute.php @@ -26,7 +26,7 @@ class DashedRoute extends Route { /** - * Flag for tracking whether or not the defaults have been inflected. + * Flag for tracking whether the defaults have been inflected. * * Default values need to be inflected so that they match the inflections that * match() will create. diff --git a/app/vendor/cakephp/cakephp/src/Routing/Route/InflectedRoute.php b/app/vendor/cakephp/cakephp/src/Routing/Route/InflectedRoute.php index 852ed07b..fdc552b6 100644 --- a/app/vendor/cakephp/cakephp/src/Routing/Route/InflectedRoute.php +++ b/app/vendor/cakephp/cakephp/src/Routing/Route/InflectedRoute.php @@ -25,7 +25,7 @@ class InflectedRoute extends Route { /** - * Flag for tracking whether or not the defaults have been inflected. + * Flag for tracking whether the defaults have been inflected. * * Default values need to be inflected so that they match the inflections that match() * will create. diff --git a/app/vendor/cakephp/cakephp/src/Routing/Route/PluginShortRoute.php b/app/vendor/cakephp/cakephp/src/Routing/Route/PluginShortRoute.php index b3e1d6fd..bf9347c2 100644 --- a/app/vendor/cakephp/cakephp/src/Routing/Route/PluginShortRoute.php +++ b/app/vendor/cakephp/cakephp/src/Routing/Route/PluginShortRoute.php @@ -18,7 +18,7 @@ /** * Plugin short route, that copies the plugin param to the controller parameters - * It is used for supporting /:plugin routes. + * It is used for supporting /{plugin} routes. */ class PluginShortRoute extends InflectedRoute { diff --git a/app/vendor/cakephp/cakephp/src/Routing/Route/RedirectRoute.php b/app/vendor/cakephp/cakephp/src/Routing/Route/RedirectRoute.php index 3be731f9..106c5a54 100644 --- a/app/vendor/cakephp/cakephp/src/Routing/Route/RedirectRoute.php +++ b/app/vendor/cakephp/cakephp/src/Routing/Route/RedirectRoute.php @@ -41,7 +41,7 @@ class RedirectRoute extends Route * * @param string $template Template string with parameter placeholders * @param array $defaults Defaults for the route. Either a redirect=>value array or a CakePHP array URL. - * @param array $options Array of additional options for the Route + * @param array $options Array of additional options for the Route */ public function __construct(string $template, array $defaults = [], array $options = []) { diff --git a/app/vendor/cakephp/cakephp/src/Routing/Route/Route.php b/app/vendor/cakephp/cakephp/src/Routing/Route/Route.php index d2bc64bb..89ce7d3f 100644 --- a/app/vendor/cakephp/cakephp/src/Routing/Route/Route.php +++ b/app/vendor/cakephp/cakephp/src/Routing/Route/Route.php @@ -82,7 +82,7 @@ class Route /** * List of connected extensions for this route. * - * @var string[] + * @var array */ protected $_extensions = []; @@ -94,19 +94,26 @@ class Route protected $middleware = []; /** - * Track whether or not brace keys `{var}` were used. + * Track whether brace keys `{var}` were used. * * @var bool */ - protected $braceKeys = false; + protected $braceKeys = true; /** * Valid HTTP methods. * - * @var array + * @var array */ public const VALID_METHODS = ['GET', 'PUT', 'POST', 'PATCH', 'DELETE', 'OPTIONS', 'HEAD']; + /** + * Regex for matching braced placholders in route template. + * + * @var string + */ + protected const PLACEHOLDER_REGEX = '#\{([a-z][a-z0-9-_]*)\}#i'; + /** * Constructor for a Route * @@ -115,15 +122,17 @@ class Route * - `_ext` - Defines the extensions used for this route. * - `_middleware` - Define the middleware names for this route. * - `pass` - Copies the listed parameters into params['pass']. + * - `_method` - Defines the HTTP method(s) the route applies to. It can be + * a string or array of valid HTTP method name. * - `_host` - Define the host name pattern if you want this route to only match * specific host names. You can use `.*` and to create wildcard subdomains/hosts * e.g. `*.example.com` matches all subdomains on `example.com`. - * - `_method` - Defines the HTTP method(s) the route applies to. It can be - * a string or array of valid HTTP method name. + * - '_port` - Define the port if you want this route to only match specific port number. + * - '_urldecode' - Set to `false` to disable URL decoding before route parsing. * * @param string $template Template string with parameter placeholders * @param array $defaults Defaults for the route. - * @param array $options Array of additional options for the Route + * @param array $options Array of additional options for the Route * @throws \InvalidArgumentException When `$options['_method']` are not in `VALID_METHODS` list. */ public function __construct(string $template, array $defaults = [], array $options = []) @@ -143,15 +152,12 @@ public function __construct(string $template, array $defaults = [], array $optio /** * Set the supported extensions for this route. * - * @param string[] $extensions The extensions to set. + * @param array $extensions The extensions to set. * @return $this */ public function setExtensions(array $extensions) { - $this->_extensions = []; - foreach ($extensions as $ext) { - $this->_extensions[] = strtolower($ext); - } + $this->_extensions = array_map('strtolower', $extensions); return $this; } @@ -159,7 +165,7 @@ public function setExtensions(array $extensions) /** * Get the supported extensions for this route. * - * @return string[] + * @return array */ public function getExtensions(): array { @@ -169,7 +175,7 @@ public function getExtensions(): array /** * Set the accepted HTTP methods for this route. * - * @param string[] $methods The HTTP methods to accept. + * @param array $methods The HTTP methods to accept. * @return $this * @throws \InvalidArgumentException When methods are not in `VALID_METHODS` list. */ @@ -183,8 +189,8 @@ public function setMethods(array $methods) /** * Normalize method names to upper case and validate that they are valid HTTP methods. * - * @param string|string[] $methods Methods. - * @return string|string[] + * @param array|string $methods Methods. + * @return array|string * @throws \InvalidArgumentException When methods are not in `VALID_METHODS` list. */ protected function normalizeAndValidateMethods($methods) @@ -209,7 +215,7 @@ protected function normalizeAndValidateMethods($methods) * If any of your patterns contain multibyte values, the `multibytePattern` * mode will be enabled. * - * @param string[] $patterns The patterns to apply to routing elements + * @param array $patterns The patterns to apply to routing elements * @return $this */ public function setPatterns(array $patterns) @@ -239,7 +245,7 @@ public function setHost(string $host) /** * Set the names of parameters that will be converted into passed parameters * - * @param string[] $names The names of the parameters that should be passed. + * @param array $names The names of the parameters that should be passed. * @return $this */ public function setPass(array $names) @@ -320,23 +326,36 @@ protected function _writeRoute(): void $parsed = preg_quote($this->template, '#'); if (strpos($route, '{') !== false && strpos($route, '}') !== false) { - preg_match_all('/\{([a-z][a-z0-9-_]*)\}/i', $route, $namedElements); - $this->braceKeys = true; + preg_match_all(static::PLACEHOLDER_REGEX, $route, $namedElements, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); } else { - preg_match_all('/:([a-z0-9-_]+(?braceKeys = false; + if ($hasMatches) { + deprecationWarning( + 'Colon prefixed route placeholders like `:foo` are deprecated.' + . ' Use braced placeholders like `{foo}` instead.' + ); + } } - foreach ($namedElements[1] as $i => $name) { - $search = preg_quote($namedElements[0][$i]); + foreach ($namedElements as $matchArray) { + // Placeholder name, e.g. "foo" + $name = $matchArray[1][0]; + // Placeholder with colon/braces, e.g. "{foo}" + $search = preg_quote($matchArray[0][0]); if (isset($this->options[$name])) { $option = ''; if ($name !== 'plugin' && array_key_exists($name, $this->defaults)) { $option = '?'; } - $slashParam = '/' . $search; // phpcs:disable Generic.Files.LineLength - if (strpos($parsed, $slashParam) !== false) { - $routeParams[$slashParam] = '(?:/(?P<' . $name . '>' . $this->options[$name] . ')' . $option . ')' . $option; + // Offset of the colon/braced placeholder in the full template string + if ($parsed[$matchArray[0][1] - 1] === '/') { + $routeParams['/' . $search] = '(?:/(?P<' . $name . '>' . $this->options[$name] . ')' . $option . ')' . $option; } else { $routeParams[$search] = '(?:(?P<' . $name . '>' . $this->options[$name] . ')' . $option . ')' . $option; } @@ -354,10 +373,7 @@ protected function _writeRoute(): void $parsed = preg_replace('#/\\\\\*$#', '(?:/(?P<_args_>.*))?', $parsed); $this->_greedy = true; } - $mode = ''; - if (!empty($this->options['multibytePattern'])) { - $mode = 'u'; - } + $mode = empty($this->options['multibytePattern']) ? '' : 'u'; krsort($routeParams); $parsed = str_replace(array_keys($routeParams), $routeParams, $parsed); $this->_compiledRoute = '#^' . $parsed . '[/]*$#' . $mode; @@ -393,8 +409,8 @@ public function getName(): string foreach ($keys as $key => $glue) { $value = null; if ( - strpos($this->template, ':' . $key) !== false - || strpos($this->template, '{' . $key . '}') !== false + strpos($this->template, '{' . $key . '}') !== false + || strpos($this->template, ':' . $key) !== false ) { $value = '_' . $key; } elseif (isset($this->defaults[$key])) { @@ -417,10 +433,10 @@ public function getName(): string * Checks to see if the given URL can be parsed by this route. * * If the route can be parsed an array of parameters will be returned; if not - * false will be returned. + * `null` will be returned. * * @param \Psr\Http\Message\ServerRequestInterface $request The URL to attempt to parse. - * @return array|null An array of request parameters, or null on failure. + * @return array|null An array of request parameters, or `null` on failure. */ public function parseRequest(ServerRequestInterface $request): ?array { @@ -436,11 +452,11 @@ public function parseRequest(ServerRequestInterface $request): ?array * Checks to see if the given URL can be parsed by this route. * * If the route can be parsed an array of parameters will be returned; if not - * false will be returned. String URLs are parsed if they match a routes regular expression. + * `null` will be returned. String URLs are parsed if they match a routes regular expression. * * @param string $url The URL to attempt to parse. * @param string $method The HTTP method of the request being parsed. - * @return array|null An array of request parameters, or null on failure. + * @return array|null An array of request parameters, or `null` on failure. * @throws \InvalidArgumentException When method is not an empty string or in `VALID_METHODS` list. */ public function parse(string $url, string $method): ?array @@ -451,7 +467,12 @@ public function parse(string $url, string $method): ?array $compiledRoute = $this->compile(); [$url, $ext] = $this->_parseExtension($url); - if (!preg_match($compiledRoute, urldecode($url), $route)) { + $urldecode = $this->options['_urldecode'] ?? true; + if ($urldecode) { + $url = urldecode($url); + } + + if (!preg_match($compiledRoute, $url, $route)) { return null; } @@ -524,7 +545,7 @@ public function parse(string $url, string $method): ?array * Check to see if the host matches the route requirements * * @param string $host The request's host name - * @return bool Whether or not the host matches any conditions set in for this route. + * @return bool Whether the host matches any conditions set in for this route. */ public function hostMatches(string $host): bool { @@ -562,18 +583,19 @@ protected function _parseExtension(string $url): array * * @param string $args A string with the passed params. eg. /1/foo * @param array $context The current route context, which should contain controller/action keys. - * @return string[] Array of passed args. + * @return array Array of passed args. */ protected function _parseArgs(string $args, array $context): array { $pass = []; $args = explode('/', $args); + $urldecode = $this->options['_urldecode'] ?? true; foreach ($args as $param) { if (empty($param) && $param !== '0') { continue; } - $pass[] = rawurldecode($param); + $pass[] = $urldecode ? rawurldecode($param) : $param; } return $pass; @@ -634,9 +656,7 @@ public function match(array $url, array $context = []): ?string if (!isset($hostOptions['_host']) && strpos($this->options['_host'], '*') === false) { $hostOptions['_host'] = $this->options['_host']; } - if (!isset($hostOptions['_host'])) { - $hostOptions['_host'] = $context['_host']; - } + $hostOptions['_host'] = $hostOptions['_host'] ?? $context['_host']; // The host did not match the route preferences if (!$this->hostMatches((string)$hostOptions['_host'])) { @@ -682,11 +702,6 @@ public function match(array $url, array $context = []): ?string } unset($url['_method'], $url['[method]'], $defaults['_method']); - // Missing defaults is a fail. - if (array_diff_key($defaults, $url) !== []) { - return null; - } - // Defaults with different values are a fail. if (array_intersect_key($url, $defaults) != $defaults) { return null; @@ -755,7 +770,7 @@ public function match(array $url, array $context = []): ?string } /** - * Check whether or not the URL's HTTP method matches. + * Check whether the URL's HTTP method matches. * * @param array $url The array for the URL being generated. * @return bool @@ -859,14 +874,22 @@ protected function _writeUrl(array $params, array $pass = [], array $query = []) */ public function staticPath(): string { + $matched = preg_match( + static::PLACEHOLDER_REGEX, + $this->template, + $namedElements, + PREG_OFFSET_CAPTURE + ); + + if ($matched) { + return substr($this->template, 0, $namedElements[0][1]); + } + $routeKey = strpos($this->template, ':'); if ($routeKey !== false) { return substr($this->template, 0, $routeKey); } - $routeKey = strpos($this->template, '{'); - if ($routeKey !== false && strpos($this->template, '}') !== false) { - return substr($this->template, 0, $routeKey); - } + $star = strpos($this->template, '*'); if ($star !== false) { $path = rtrim(substr($this->template, 0, $star), '/'); @@ -907,7 +930,7 @@ public function getMiddleware(): array * This method helps for applications that want to implement * router caching. * - * @param array $fields Key/Value of object attributes + * @param array $fields Key/Value of object attributes * @return static A new instance of the route */ public static function __set_state(array $fields) diff --git a/app/vendor/cakephp/cakephp/src/Routing/RouteBuilder.php b/app/vendor/cakephp/cakephp/src/Routing/RouteBuilder.php index dc9d63a9..16aec336 100644 --- a/app/vendor/cakephp/cakephp/src/Routing/RouteBuilder.php +++ b/app/vendor/cakephp/cakephp/src/Routing/RouteBuilder.php @@ -51,14 +51,14 @@ class RouteBuilder /** * Default HTTP request method => controller action map. * - * @var array + * @var array */ protected static $_resourceMap = [ 'index' => ['action' => 'index', 'method' => 'GET', 'path' => ''], 'create' => ['action' => 'add', 'method' => 'POST', 'path' => ''], - 'view' => ['action' => 'view', 'method' => 'GET', 'path' => ':id'], - 'update' => ['action' => 'edit', 'method' => ['PUT', 'PATCH'], 'path' => ':id'], - 'delete' => ['action' => 'delete', 'method' => 'DELETE', 'path' => ':id'], + 'view' => ['action' => 'view', 'method' => 'GET', 'path' => '{id}'], + 'update' => ['action' => 'edit', 'method' => ['PUT', 'PATCH'], 'path' => '{id}'], + 'delete' => ['action' => 'delete', 'method' => 'DELETE', 'path' => '{id}'], ]; /** @@ -71,7 +71,7 @@ class RouteBuilder /** * The extensions that should be set into the routes connected. * - * @var string[] + * @var array */ protected $_extensions = []; @@ -107,7 +107,7 @@ class RouteBuilder * The list of middleware that routes in this builder get * added during construction. * - * @var string[] + * @var array */ protected $middleware = []; @@ -124,7 +124,7 @@ class RouteBuilder * @param \Cake\Routing\RouteCollection $collection The route collection to append routes into. * @param string $path The path prefix the scope is for. * @param array $params The scope's routing parameters. - * @param array $options Options list. + * @param array $options Options list. */ public function __construct(RouteCollection $collection, string $path, array $params = [], array $options = []) { @@ -174,7 +174,7 @@ public function getRouteClass(): string * Future routes connected in through this builder will have the connected * extensions applied. However, setting extensions does not modify existing routes. * - * @param string|string[] $extensions The extensions to set. + * @param array|string $extensions The extensions to set. * @return $this */ public function setExtensions($extensions) @@ -187,7 +187,7 @@ public function setExtensions($extensions) /** * Get the extensions in this route builder's scope. * - * @return string[] + * @return array */ public function getExtensions(): array { @@ -197,7 +197,7 @@ public function getExtensions(): array /** * Add additional extensions to what is already in current scope * - * @param string|string[] $extensions One or more extensions to add + * @param array|string $extensions One or more extensions to add * @return $this */ public function addExtensions($extensions) @@ -215,6 +215,11 @@ public function addExtensions($extensions) */ public function path(): string { + $routeKey = strpos($this->_path, '{'); + if ($routeKey !== false && strpos($this->_path, '}') !== false) { + return substr($this->_path, 0, $routeKey); + } + $routeKey = strpos($this->_path, ':'); if ($routeKey !== false) { return substr($this->_path, 0, $routeKey); @@ -307,7 +312,7 @@ public function namePrefix(?string $value = null): string * }); * ``` * - * The above would generate both resource routes for `/articles`, and `/articles/:article_id/comments`. + * The above would generate both resource routes for `/articles`, and `/articles/{article_id}/comments`. * You can use the `map` option to connect additional resource methods: * * ``` @@ -317,7 +322,7 @@ public function namePrefix(?string $value = null): string * ``` * * In addition to the default routes, this would also connect a route for `/articles/delete_all`. - * By default the path segment will match the key name. You can use the 'path' key inside the resource + * By default, the path segment will match the key name. You can use the 'path' key inside the resource * definition to customize the path name. * * You can use the `inflect` option to change how path segments are generated: @@ -344,7 +349,7 @@ public function namePrefix(?string $value = null): string * is available at `/posts` * * @param string $name A controller name to connect resource routes for. - * @param array|callable $options Options to use when generating REST routes, or a callback. + * @param callable|array $options Options to use when generating REST routes, or a callback. * @param callable|null $callback An optional callback to be executed in a nested scope. Nested * scopes inherit the existing path and 'id' parameter. * @return $this @@ -400,10 +405,7 @@ public function resources(string $name, $options = [], $callback = null) continue; } - $action = $params['action']; - if (isset($options['actions'][$method])) { - $action = $options['actions'][$method]; - } + $action = $options['actions'][$method] ?? $params['action']; $url = '/' . implode('/', array_filter([$options['path'], $params['path']])); $params = [ @@ -424,7 +426,7 @@ public function resources(string $name, $options = [], $callback = null) if ($callback !== null) { $idName = Inflector::singularize(Inflector::underscore($name)) . '_id'; - $path = '/' . $options['path'] . '/:' . $idName; + $path = '/' . $options['path'] . '/{' . $idName . '}'; $this->scope($path, [], $callback); } @@ -644,6 +646,10 @@ public function loadPlugin(string $name) * - `_ext` is an array of filename extensions that will be parsed out of the url if present. * See {@link \Cake\Routing\RouteCollection::setExtensions()}. * - `_method` Only match requests with specific HTTP verbs. + * - `_host` - Define the host name pattern if you want this route to only match + * specific host names. You can use `.*` and to create wildcard subdomains/hosts + * e.g. `*.example.com` matches all subdomains on `example.com`. + * - '_port` - Define the port if you want this route to only match specific port number. * * Example of using the `_method` condition: * @@ -653,10 +659,10 @@ public function loadPlugin(string $name) * * The above route will only be matched for GET requests. POST requests will fail to match this route. * - * @param string|\Cake\Routing\Route\Route $route A string describing the template of the route + * @param \Cake\Routing\Route\Route|string $route A string describing the template of the route * @param array|string $defaults An array describing the default route parameters. * These parameters will be used by default and can supply routing parameters that are not dynamic. See above. - * @param array $options An array matching the named elements in the route to regular expressions which that + * @param array $options An array matching the named elements in the route to regular expressions which that * element should match. Also contains additional parameters such as which routed parameters should be * shifted into the passed arguments, supplying patterns for routing parameters and supplying the name of a * custom routing class. @@ -689,7 +695,7 @@ public function connect($route, $defaults = [], array $options = []): Route /** * Parse the defaults if they're a string * - * @param string|array $defaults Defaults array from the connect() method. + * @param array|string $defaults Defaults array from the connect() method. * @return array */ protected function parseDefaults($defaults): array @@ -704,9 +710,9 @@ protected function parseDefaults($defaults): array /** * Create a route object, or return the provided object. * - * @param string|\Cake\Routing\Route\Route $route The route template or route object. + * @param \Cake\Routing\Route\Route|string $route The route template or route object. * @param array $defaults Default parameters. - * @param array $options Additional options parameters. + * @param array $options Additional options parameters. * @return \Cake\Routing\Route\Route * @throws \InvalidArgumentException when route class or route object is invalid. * @throws \BadMethodCallException when the route to make conflicts with the current scope @@ -786,16 +792,14 @@ protected function _makeRoute($route, $defaults, $options): Route * * @param string $route A string describing the template of the route * @param array|string $url A URL to redirect to. Can be a string or a Cake array-based URL - * @param array $options An array matching the named elements in the route to regular expressions which that + * @param array $options An array matching the named elements in the route to regular expressions which that * element should match. Also contains additional parameters such as which routed parameters should be * shifted into the passed arguments. As well as supplying patterns for routing parameters. * @return \Cake\Routing\Route\Route|\Cake\Routing\Route\RedirectRoute */ public function redirect(string $route, $url, array $options = []): Route { - if (!isset($options['routeClass'])) { - $options['routeClass'] = RedirectRoute::class; - } + $options['routeClass'] = $options['routeClass'] ?? RedirectRoute::class; if (is_string($url)) { $url = ['redirect' => $url]; } @@ -829,7 +833,7 @@ public function redirect(string $route, $url, array $options = []): Route * ``` * * @param string $name The prefix name to use. - * @param array|callable $params An array of routing defaults to add to each connected route. + * @param callable|array $params An array of routing defaults to add to each connected route. * If you have no parameters, this argument can be a callable. * @param callable|null $callback The callback to invoke that builds the prefixed routes. * @return $this @@ -875,7 +879,7 @@ public function prefix(string $name, $params = [], $callback = null) * name of any route created in a scope callback. * * @param string $name The plugin name to build routes for - * @param array|callable $options Either the options to use, or a callback to build routes. + * @param callable|array $options Either the options to use, or a callback to build routes. * @param callable|null $callback The callback to invoke that builds the plugin routes * Only required when $options is defined. * @return $this @@ -908,7 +912,7 @@ public function plugin(string $name, $options = [], $callback = null) * name of any route created in a scope callback. * * @param string $path The path to create a scope for. - * @param array|callable $params Either the parameters to add to routes, or a callback. + * @param callable|array $params Either the parameters to add to routes, or a callback. * @param callable|null $callback The callback to invoke that builds the plugin routes. * Only required when $params is defined. * @return $this @@ -973,7 +977,7 @@ public function fallbacks(?string $routeClass = null) * scope or any child scopes that share the same RouteCollection. * * @param string $name The name of the middleware. Used when applying middleware to a scope. - * @param string|\Closure|\Psr\Http\Server\MiddlewareInterface $middleware The middleware to register. + * @param \Psr\Http\Server\MiddlewareInterface|\Closure|string $middleware The middleware to register. * @return $this * @see \Cake\Routing\RouteCollection */ @@ -1022,7 +1026,7 @@ public function getMiddleware(): array * Apply a set of middleware to a group * * @param string $name Name of the middleware group - * @param string[] $middlewareNames Names of the middleware + * @param array $middlewareNames Names of the middleware * @return $this */ public function middlewareGroup(string $name, array $middlewareNames) diff --git a/app/vendor/cakephp/cakephp/src/Routing/RouteCollection.php b/app/vendor/cakephp/cakephp/src/Routing/RouteCollection.php index 0cb87e73..12260605 100644 --- a/app/vendor/cakephp/cakephp/src/Routing/RouteCollection.php +++ b/app/vendor/cakephp/cakephp/src/Routing/RouteCollection.php @@ -35,14 +35,14 @@ class RouteCollection /** * The routes connected to this collection. * - * @var array + * @var array> */ protected $_routeTable = []; /** * The hash map of named routes that are in this collection. * - * @var \Cake\Routing\Route\Route[] + * @var array<\Cake\Routing\Route\Route> */ protected $_named = []; @@ -70,7 +70,7 @@ class RouteCollection /** * Route extensions * - * @var string[] + * @var array */ protected $_extensions = []; @@ -78,7 +78,7 @@ class RouteCollection * Add a route to the collection. * * @param \Cake\Routing\Route\Route $route The route object to add. - * @param array $options Additional options for the route. Primarily for the + * @param array $options Additional options for the route. Primarily for the * `_name` option, which enables named routes. * @return void */ @@ -99,9 +99,7 @@ public function add(Route $route, array $options = []): void // Generated names. $name = $route->getName(); - if (!isset($this->_routeTable[$name])) { - $this->_routeTable[$name] = []; - } + $this->_routeTable[$name] = $this->_routeTable[$name] ?? []; $this->_routeTable[$name][] = $route; // Index path prefixes (for parsing) @@ -204,7 +202,7 @@ public function parseRequest(ServerRequestInterface $request): array * and newer style urls containing '_name' * * @param array $url The url to match. - * @return string[] The set of names of the url + * @return array The set of names of the url */ protected function _getNames(array $url): array { @@ -318,11 +316,10 @@ public function match(array $url, array $context): string if (empty($this->_routeTable[$name])) { continue; } - /** @var \Cake\Routing\Route\Route $route */ foreach ($this->_routeTable[$name] as $route) { $match = $route->match($url, $context); if ($match) { - return strlen($match) > 1 ? trim($match, '/') : $match; + return $match === '/' ? $match : trim($match, '/'); } } } @@ -332,7 +329,7 @@ public function match(array $url, array $context): string /** * Get all the connected routes as a flat list. * - * @return \Cake\Routing\Route\Route[] + * @return array<\Cake\Routing\Route\Route> */ public function routes(): array { @@ -348,7 +345,7 @@ public function routes(): array /** * Get the connected named routes. * - * @return \Cake\Routing\Route\Route[] + * @return array<\Cake\Routing\Route\Route> */ public function named(): array { @@ -358,7 +355,7 @@ public function named(): array /** * Get the extensions that can be handled. * - * @return string[] The valid extensions. + * @return array The valid extensions. */ public function getExtensions(): array { @@ -368,7 +365,7 @@ public function getExtensions(): array /** * Set the extensions that the route collection can handle. * - * @param string[] $extensions The list of extensions to set. + * @param array $extensions The list of extensions to set. * @param bool $merge Whether to merge with or override existing extensions. * Defaults to `true`. * @return $this @@ -393,7 +390,7 @@ public function setExtensions(array $extensions, bool $merge = true) * scope or any child scopes that share the same RouteCollection. * * @param string $name The name of the middleware. Used when applying middleware to a scope. - * @param string|\Closure|\Psr\Http\Server\MiddlewareInterface $middleware The middleware to register. + * @param \Psr\Http\Server\MiddlewareInterface|\Closure|string $middleware The middleware to register. * @return $this * @throws \RuntimeException */ @@ -408,7 +405,7 @@ public function registerMiddleware(string $name, $middleware) * Add middleware to a middleware group * * @param string $name Name of the middleware group - * @param string[] $middlewareNames Names of the middleware + * @param array $middlewareNames Names of the middleware * @return $this * @throws \RuntimeException */ @@ -467,7 +464,7 @@ public function middlewareExists(string $name): bool /** * Get an array of middleware given a list of names * - * @param string[] $names The names of the middleware or groups to fetch + * @param array $names The names of the middleware or groups to fetch * @return array An array of middleware. If any of the passed names are groups, * the groups middleware will be flattened into the returned list. * @throws \RuntimeException when a requested middleware does not exist. diff --git a/app/vendor/cakephp/cakephp/src/Routing/Router.php b/app/vendor/cakephp/cakephp/src/Routing/Router.php index 0c2743b6..c6808c92 100644 --- a/app/vendor/cakephp/cakephp/src/Routing/Router.php +++ b/app/vendor/cakephp/cakephp/src/Routing/Router.php @@ -114,7 +114,7 @@ class Router /** * Named expressions * - * @var array + * @var array */ protected static $_namedExpressions = [ 'Action' => Router::ACTION, @@ -145,14 +145,14 @@ class Router * The stack of URL filters to apply against routing URLs before passing the * parameters to the route collection. * - * @var callable[] + * @var array */ protected static $_urlFilters = []; /** * Default extensions defined with Router::extensions() * - * @var string[] + * @var array */ protected static $_defaultExtensions = []; @@ -182,7 +182,7 @@ public static function defaultRouteClass(?string $routeClass = null): ?string /** * Gets the named route patterns for use in config/routes.php * - * @return array Named route elements + * @return array Named route elements * @see \Cake\Routing\Router::$_namedExpressions */ public static function getNamedExpressions(): array @@ -195,10 +195,10 @@ public static function getNamedExpressions(): array * * Compatibility proxy to \Cake\Routing\RouteBuilder::connect() in the `/` scope. * - * @param string|\Cake\Routing\Route\Route $route A string describing the template of the route + * @param \Cake\Routing\Route\Route|string $route A string describing the template of the route * @param array|string $defaults An array describing the default route parameters. * These parameters will be used by default and can supply routing parameters that are not dynamic. See above. - * @param array $options An array matching the named elements in the route to regular expressions which that + * @param array $options An array matching the named elements in the route to regular expressions which that * element should match. Also contains additional parameters such as which routed parameters should be * shifted into the passed arguments, supplying patterns for routing parameters and supplying the name of a * custom routing class. @@ -206,9 +206,14 @@ public static function getNamedExpressions(): array * @throws \Cake\Core\Exception\CakeException * @see \Cake\Routing\RouteBuilder::connect() * @see \Cake\Routing\Router::scope() + * @deprecated 4.3.0 Use the non-static method `RouteBuilder::connect()` instead. */ public static function connect($route, $defaults = [], $options = []): void { + deprecationWarning( + '`Router::connect()` is deprecated, use the non-static method `RouteBuilder::connect()` instead.' + ); + static::scope('/', function ($routes) use ($route, $defaults, $options): void { /** @var \Cake\Routing\RouteBuilder $routes */ $routes->connect($route, $defaults, $options); @@ -400,7 +405,7 @@ protected static function _applyUrlFilters(array $url): array * - `_name` - Name of route. If you have setup named routes you can use this key * to specify it. * - * @param string|array|\Psr\Http\Message\UriInterface|null $url An array specifying any of the following: + * @param \Psr\Http\Message\UriInterface|array|string|null $url An array specifying any of the following: * 'controller', 'action', 'plugin' additionally, you can provide routed * elements or query string parameters. If string it can be name any valid url * string or it can be an UriInterface instance. @@ -414,9 +419,7 @@ public static function url($url = null, bool $full = false): string $context = static::$_requestContext; $request = static::getRequest(); - if (!isset($context['_base'])) { - $context['_base'] = Configure::read('App.base') ?: ''; - } + $context['_base'] = $context['_base'] ?? Configure::read('App.base') ?: ''; if (empty($url)) { $here = $request ? $request->getRequestTarget() : '/'; @@ -552,7 +555,7 @@ public static function pathUrl(string $path, array $params = [], bool $full = fa * ### Usage * * @see Router::url() - * @param string|array|null $url An array specifying any of the following: + * @param array|string|null $url An array specifying any of the following: * 'controller', 'action', 'plugin' additionally, you can provide routed * elements or query string parameters. If string it can be name any valid url * string. @@ -647,11 +650,28 @@ public static function reverseToArray($params): array } $pass = $params['pass'] ?? []; + $template = $params['_matchedRoute'] ?? null; unset( $params['pass'], $params['_matchedRoute'], $params['_name'] ); + $route = null; + if ($template) { + // Locate the route that was used to match this route + // so we can access the pass parameter configuration. + foreach (static::getRouteCollection()->routes() as $maybe) { + if ($maybe->template === $template) { + $route = $maybe; + break; + } + } + } + if ($route) { + // If we found a route, slice off the number of passed args. + $routePass = $route->options['pass'] ?? []; + $pass = array_slice($pass, count($routePass)); + } $params = array_merge($params, $pass); return $params; @@ -697,8 +717,8 @@ public static function normalize($url = '/'): string $request = static::getRequest(); if ($request) { - $base = $request->getAttribute('base'); - if (strlen($base) && stristr($url, $base)) { + $base = $request->getAttribute('base', ''); + if ($base !== '' && stristr($url, $base)) { $url = preg_replace('/^' . preg_quote($base, '/') . '/', '', $url, 1); } } @@ -731,10 +751,10 @@ public static function normalize($url = '/'): string * A string or an array of valid extensions can be passed to this method. * If called without any parameters it will return current list of set extensions. * - * @param string[]|string|null $extensions List of extensions to be added. + * @param array|string|null $extensions List of extensions to be added. * @param bool $merge Whether to merge with or override existing extensions. * Defaults to `true`. - * @return string[] Array of extensions Router is configured to parse. + * @return array Array of extensions Router is configured to parse. */ public static function extensions($extensions = null, $merge = true): array { @@ -742,6 +762,7 @@ public static function extensions($extensions = null, $merge = true): array if ($extensions === null) { return array_unique(array_merge(static::$_defaultExtensions, $collection->getExtensions())); } + $extensions = (array)$extensions; if ($merge) { $extensions = array_unique(array_merge(static::$_defaultExtensions, $extensions)); @@ -754,7 +775,7 @@ public static function extensions($extensions = null, $merge = true): array * Create a RouteBuilder for the provided path. * * @param string $path The path to set the builder to. - * @param array $options The options for the builder + * @param array $options The options for the builder * @return \Cake\Routing\RouteBuilder */ public static function createRouteBuilder(string $path, array $options = []): RouteBuilder @@ -807,14 +828,19 @@ public static function createRouteBuilder(string $path, array $options = []): Ro * * @param string $path The path prefix for the scope. This path will be prepended * to all routes connected in the scoped collection. - * @param array|callable $params An array of routing defaults to add to each connected route. + * @param callable|array $params An array of routing defaults to add to each connected route. * If you have no parameters, this argument can be a callable. * @param callable|null $callback The callback to invoke with the scoped collection. * @throws \InvalidArgumentException When an invalid callable is provided. * @return void + * @deprecated 4.3.0 Use the non-static method `RouteBuilder::scope()` instead. */ public static function scope(string $path, $params = [], $callback = null): void { + deprecationWarning( + '`Router::scope()` is deprecated, use the non-static method `RouteBuilder::scope()` instead.' + ); + $options = []; if (is_array($params)) { $options = $params; @@ -842,13 +868,18 @@ public static function scope(string $path, $params = [], $callback = null): void * to the `Controller\Admin\Api\` namespace. * * @param string $name The prefix name to use. - * @param array|callable $params An array of routing defaults to add to each connected route. + * @param callable|array $params An array of routing defaults to add to each connected route. * If you have no parameters, this argument can be a callable. * @param callable|null $callback The callback to invoke that builds the prefixed routes. * @return void + * @deprecated 4.3.0 Use the non-static method `RouteBuilder::prefix()` instead. */ public static function prefix(string $name, $params = [], $callback = null): void { + deprecationWarning( + '`Router::prefix()` is deprecated, use the non-static method `RouteBuilder::prefix()` instead.' + ); + if (!is_array($params)) { $callback = $params; $params = []; @@ -874,13 +905,18 @@ public static function prefix(string $name, $params = [], $callback = null): voi * prepended, and have a matching plugin routing key set. * * @param string $name The plugin name to build routes for - * @param array|callable $options Either the options to use, or a callback + * @param callable|array $options Either the options to use, or a callback * @param callable|null $callback The callback to invoke that builds the plugin routes. * Only required when $options is defined * @return void + * @deprecated 4.3.0 Use the non-static method `RouteBuilder::plugin()` instead. */ public static function plugin(string $name, $options = [], $callback = null): void { + deprecationWarning( + '`Router::plugin()` is deprecated, use the non-static method `RouteBuilder::plugin()` instead.' + ); + if (!is_array($options)) { $callback = $options; $options = []; @@ -896,7 +932,7 @@ public static function plugin(string $name, $options = [], $callback = null): vo /** * Get the route scopes and their connected routes. * - * @return \Cake\Routing\Route\Route[] + * @return array<\Cake\Routing\Route\Route> */ public static function routes(): array { @@ -959,7 +995,7 @@ protected static function unwrapShortString(array $url) * - Vendor/Cms.Management/Admin/Articles::view * * @param string $url Route path in [Plugin.][Prefix/]Controller::action format - * @return string[] + * @return array */ public static function parseRoutePath(string $url): array { diff --git a/app/vendor/cakephp/cakephp/src/Shell/Helper/ProgressHelper.php b/app/vendor/cakephp/cakephp/src/Shell/Helper/ProgressHelper.php index 9b49d98d..b91a69c5 100644 --- a/app/vendor/cakephp/cakephp/src/Shell/Helper/ProgressHelper.php +++ b/app/vendor/cakephp/cakephp/src/Shell/Helper/ProgressHelper.php @@ -38,7 +38,7 @@ class ProgressHelper extends Helper /** * The current progress. * - * @var int|float + * @var float|int */ protected $_progress = 0; @@ -113,7 +113,7 @@ public function init(array $args = []) /** * Increment the progress bar. * - * @param int|float $num The amount of progress to advance by. + * @param float|int $num The amount of progress to advance by. * @return $this */ public function increment($num = 1) diff --git a/app/vendor/cakephp/cakephp/src/Shell/Helper/TableHelper.php b/app/vendor/cakephp/cakephp/src/Shell/Helper/TableHelper.php index b384e9fb..ff22acfc 100644 --- a/app/vendor/cakephp/cakephp/src/Shell/Helper/TableHelper.php +++ b/app/vendor/cakephp/cakephp/src/Shell/Helper/TableHelper.php @@ -27,7 +27,7 @@ class TableHelper extends Helper /** * Default config for this helper. * - * @var array + * @var array */ protected $_defaultConfig = [ 'headers' => true, @@ -39,7 +39,7 @@ class TableHelper extends Helper * Calculate the column widths * * @param array $rows The rows on which the columns width will be calculated on. - * @return int[] + * @return array */ protected function _calculateWidths(array $rows): array { @@ -64,7 +64,7 @@ protected function _calculateWidths(array $rows): array */ protected function _cellWidth(string $text): int { - if (strlen($text) === 0) { + if ($text === '') { return 0; } @@ -82,7 +82,7 @@ protected function _cellWidth(string $text): int /** * Output a row separator. * - * @param int[] $widths The widths of each column to output. + * @param array $widths The widths of each column to output. * @return void */ protected function _rowSeparator(array $widths): void @@ -99,8 +99,8 @@ protected function _rowSeparator(array $widths): void * Output a row. * * @param array $row The row to output. - * @param int[] $widths The widths of each column to output. - * @param array $options Options to be passed. + * @param array $widths The widths of each column to output. + * @param array $options Options to be passed. * @return void */ protected function _render(array $row, array $widths, array $options = []): void @@ -116,7 +116,7 @@ protected function _render(array $row, array $widths, array $options = []): void if (!empty($options['style'])) { $column = $this->_addStyle($column, $options['style']); } - if (strlen($column) > 0 && preg_match('#(.*).+(.*)#', $column, $matches)) { + if ($column !== '' && preg_match('#(.*).+(.*)#', $column, $matches)) { if ($matches[1] !== '' || $matches[2] !== '') { throw new UnexpectedValueException('You cannot include text before or after the text-right tag.'); } diff --git a/app/vendor/cakephp/cakephp/src/Shell/Task/CommandTask.php b/app/vendor/cakephp/cakephp/src/Shell/Task/CommandTask.php index e41434df..1b945aa6 100644 --- a/app/vendor/cakephp/cakephp/src/Shell/Task/CommandTask.php +++ b/app/vendor/cakephp/cakephp/src/Shell/Task/CommandTask.php @@ -65,11 +65,11 @@ public function getShellList() /** * Find shells in $path and add them to $shellList * - * @param array $shellList The shell listing array. + * @param array $shellList The shell listing array. * @param string $path The path to look in. * @param string $key The key to add shells to - * @param string[] $skip A list of commands to exclude. - * @return array The updated list of shells. + * @param array $skip A list of commands to exclude. + * @return array The updated list of shells. */ protected function _findShells(array $shellList, string $path, string $key, array $skip): array { @@ -82,16 +82,14 @@ protected function _findShells(array $shellList, string $path, string $key, arra * Scan the provided paths for shells, and append them into $shellList * * @param string $type The type of object. - * @param string[] $shells The shell names. - * @param array $shellList List of shells. - * @param string[] $skip List of command names to skip. - * @return array The updated $shellList + * @param array $shells The shell names. + * @param array $shellList List of shells. + * @param array $skip List of command names to skip. + * @return array The updated $shellList */ protected function _appendShells(string $type, array $shells, array $shellList, array $skip): array { - if (!isset($shellList[$type])) { - $shellList[$type] = []; - } + $shellList[$type] = $shellList[$type] ?? []; foreach ($shells as $shell) { $name = Inflector::underscore(preg_replace('/(Shell|Command)$/', '', $shell)); @@ -109,7 +107,7 @@ protected function _appendShells(string $type, array $shells, array $shellList, * should be within them. * * @param string $dir The directory to read. - * @return array The list of shell classnames based on conventions. + * @return array The list of shell classnames based on conventions. */ protected function _scanDir(string $dir): array { diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/ConsoleIntegrationTestTrait.php b/app/vendor/cakephp/cakephp/src/TestSuite/ConsoleIntegrationTestTrait.php index 45f02d29..e2933032 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/ConsoleIntegrationTestTrait.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/ConsoleIntegrationTestTrait.php @@ -42,7 +42,7 @@ trait ConsoleIntegrationTestTrait use ContainerStubTrait; /** - * Whether or not to use the CommandRunner + * Whether to use the CommandRunner * * @var bool */ @@ -293,7 +293,7 @@ protected function makeRunner() * Creates an $argv array from a command string * * @param string $command Command string - * @return string[] + * @return array */ protected function commandStringToArgs(string $command): array { @@ -307,7 +307,7 @@ protected function commandStringToArgs(string $command): array // end of argument if ($char === ' ' && !$inDQuote && !$inSQuote) { - if (strlen($arg)) { + if ($arg !== '') { $argv[] = $arg; } $arg = ''; diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Console/ContentsBase.php b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Console/ContentsBase.php index f5895382..9ebd33fe 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Console/ContentsBase.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Console/ContentsBase.php @@ -37,7 +37,7 @@ abstract class ContentsBase extends Constraint /** * Constructor * - * @param string[] $contents Contents + * @param array $contents Contents * @param string $output Output type */ public function __construct(array $contents, string $output) diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Console/ExitCode.php b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Console/ExitCode.php index 660b629f..913bbc4a 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Console/ExitCode.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Console/ExitCode.php @@ -32,7 +32,7 @@ class ExitCode extends Constraint /** * Constructor * - * @param int $exitCode Exit code + * @param int|null $exitCode Exit code */ public function __construct(?int $exitCode) { diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Email/MailConstraintBase.php b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Email/MailConstraintBase.php index fcb26812..fc549483 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Email/MailConstraintBase.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Email/MailConstraintBase.php @@ -45,7 +45,7 @@ public function __construct(?int $at = null) /** * Gets the email or emails to check * - * @return \Cake\Mailer\Message[] + * @return array<\Cake\Mailer\Message> */ public function getMessages() { diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Email/MailContains.php b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Email/MailContains.php index 783c31cd..74ba2aac 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Email/MailContains.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Email/MailContains.php @@ -38,12 +38,12 @@ class MailContains extends MailConstraintBase */ public function matches($other): bool { + $other = preg_quote($other, '/'); $messages = $this->getMessages(); foreach ($messages as $message) { $method = $this->getTypeMethod(); $message = $message->$method(); - $other = preg_quote($other, '/'); if (preg_match("/$other/", $message) > 0) { return true; } diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/EventFiredWith.php b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/EventFiredWith.php index 13ad4a17..94b8ec6b 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/EventFiredWith.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/EventFiredWith.php @@ -84,7 +84,7 @@ public function matches($other): bool return false; } - /** @var \Cake\Event\EventInterface[] $events */ + /** @var array<\Cake\Event\EventInterface> $events */ $events = $eventGroup[$other]; if (count($events) > 1) { diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Response/StatusCodeBase.php b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Response/StatusCodeBase.php index 4940081e..d41e4da3 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Response/StatusCodeBase.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Response/StatusCodeBase.php @@ -19,20 +19,18 @@ * StatusCodeBase * * @internal - * @template TCode as int|array */ abstract class StatusCodeBase extends ResponseBase { /** - * @var int|array - * @psalm-var TCode + * @var array|int */ protected $code; /** * Check assertion * - * @param int|array $other Array of min/max status codes, or a single code + * @param array|int $other Array of min/max status codes, or a single code * @return bool * @psalm-suppress MoreSpecificImplementedParamType */ diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Response/StatusError.php b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Response/StatusError.php index 189d8112..b46c155d 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Response/StatusError.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Response/StatusError.php @@ -19,12 +19,11 @@ * StatusError * * @internal - * @extends \Cake\TestSuite\Constraint\Response\StatusCodeBase> */ class StatusError extends StatusCodeBase { /** - * @var array + * @var array|int */ protected $code = [400, 429]; diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Response/StatusFailure.php b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Response/StatusFailure.php index 33d4df2d..21561261 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Response/StatusFailure.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Response/StatusFailure.php @@ -19,12 +19,11 @@ * StatusFailure * * @internal - * @extends \Cake\TestSuite\Constraint\Response\StatusCodeBase> */ class StatusFailure extends StatusCodeBase { /** - * @var array + * @var array|int */ protected $code = [500, 505]; diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Response/StatusOk.php b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Response/StatusOk.php index 8047ff91..c8f67d86 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Response/StatusOk.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Response/StatusOk.php @@ -19,12 +19,11 @@ * StatusOk * * @internal - * @extends \Cake\TestSuite\Constraint\Response\StatusCodeBase> */ class StatusOk extends StatusCodeBase { /** - * @var array + * @var array|int */ protected $code = [200, 204]; diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Response/StatusSuccess.php b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Response/StatusSuccess.php index 10b873de..f7dfff5a 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Response/StatusSuccess.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Response/StatusSuccess.php @@ -19,12 +19,11 @@ * StatusSuccess * * @internal - * @extends \Cake\TestSuite\Constraint\Response\StatusCodeBase> */ class StatusSuccess extends StatusCodeBase { /** - * @var array + * @var array|int */ protected $code = [200, 308]; diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Session/FlashParamEquals.php b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Session/FlashParamEquals.php index 06594312..a1de975d 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Session/FlashParamEquals.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Session/FlashParamEquals.php @@ -80,9 +80,10 @@ public function matches($other): bool // Server::run calls Session::close at the end of the request. // Which means, that we cannot use Session object here to access the session data. // Call to Session::read will start new session (and will erase the data). - + /** @psalm-suppress InvalidScalarArgument */ $messages = (array)Hash::get($_SESSION, 'Flash.' . $this->key); if ($this->at) { + /** @psalm-suppress InvalidScalarArgument */ $messages = [Hash::get($_SESSION, 'Flash.' . $this->key . '.' . $this->at)]; } diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Session/SessionEquals.php b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Session/SessionEquals.php index 5cb47039..6d96c270 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Session/SessionEquals.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Session/SessionEquals.php @@ -51,6 +51,7 @@ public function matches($other): bool // Server::run calls Session::close at the end of the request. // Which means, that we cannot use Session object here to access the session data. // Call to Session::read will start new session (and will erase the data). + /** @psalm-suppress InvalidScalarArgument */ return Hash::get($_SESSION, $this->path) === $other; } diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Session/SessionHasKey.php b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Session/SessionHasKey.php index 2240d3e0..e529249c 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Session/SessionHasKey.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/Constraint/Session/SessionHasKey.php @@ -51,6 +51,7 @@ public function matches($other): bool // Server::run calls Session::close at the end of the request. // Which means, that we cannot use Session object here to access the session data. // Call to Session::read will start new session (and will erase the data). + /** @psalm-suppress InvalidScalarArgument */ return Hash::check($_SESSION, $this->path) === true; } diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/ContainerStubTrait.php b/app/vendor/cakephp/cakephp/src/TestSuite/ContainerStubTrait.php index 35b68ac7..0ca27690 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/ContainerStubTrait.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/ContainerStubTrait.php @@ -135,7 +135,7 @@ public function removeMockService(string $class) * * @param \Cake\Event\EventInterface $event The event * @param \Cake\Core\ContainerInterface $container The container to wrap. - * @return null|\Cake\Core\ContainerInterface + * @return \Cake\Core\ContainerInterface|null */ public function modifyContainer(EventInterface $event, ContainerInterface $container): ?ContainerInterface { diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureInjector.php b/app/vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureInjector.php index d858fdee..ade52d89 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureInjector.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureInjector.php @@ -25,6 +25,8 @@ /** * Test listener used to inject a fixture manager in all tests that * are composed inside a Test Suite + * + * @deprecated 4.3.0 */ class FixtureInjector implements TestListener { @@ -56,6 +58,7 @@ public function __construct(FixtureManager $manager) } $this->_fixtureManager = $manager; $this->_fixtureManager->shutDown(); + TestCase::$fixtureManager = $manager; } /** @@ -68,6 +71,13 @@ public function __construct(FixtureManager $manager) public function startTestSuite(TestSuite $suite): void { if (empty($this->_first)) { + deprecationWarning( + 'You are using the listener based PHPUnit integration. ' . + 'This fixture system is deprecated, and we recommend you ' . + 'upgrade to the extension based PHPUnit integration. ' . + 'See https://book.cakephp.org/4/en/appendices/fixture-upgrade.html', + 0 + ); $this->_first = $suite; } } @@ -94,8 +104,6 @@ public function endTestSuite(TestSuite $suite): void */ public function startTest(Test $test): void { - /** @psalm-suppress NoInterfaceProperties */ - $test->fixtureManager = $this->_fixtureManager; if ($test instanceof TestCase) { $this->_fixtureManager->fixturize($test); $this->_fixtureManager->load($test); diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureManager.php b/app/vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureManager.php index e0f00874..93d6732e 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureManager.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureManager.php @@ -44,28 +44,28 @@ class FixtureManager /** * Holds the fixture classes that where instantiated * - * @var \Cake\Datasource\FixtureInterface[] + * @var array<\Cake\Datasource\FixtureInterface> */ protected $_loaded = []; /** * Holds the fixture classes that where instantiated indexed by class name * - * @var \Cake\Datasource\FixtureInterface[] + * @var array<\Cake\Datasource\FixtureInterface> */ protected $_fixtureMap = []; /** * A map of connection names and the fixture currently in it. * - * @var array + * @var array> */ protected $_insertionMap = []; /** * List of TestCase class name that have been processed * - * @var array + * @var array */ protected $_processed = []; @@ -80,7 +80,7 @@ class FixtureManager /** * Modify the debug mode. * - * @param bool $debug Whether or not fixture debug mode is enabled. + * @param bool $debug Whether fixture debug mode is enabled. * @return void */ public function setDebug(bool $debug): void @@ -89,9 +89,7 @@ public function setDebug(bool $debug): void } /** - * Inspects the test to look for unloaded fixtures and loads them - * - * @param \Cake\TestSuite\TestCase $test The test case to inspect. + * @param \Cake\TestSuite\TestCase $test Test case * @return void */ public function fixturize(TestCase $test): void @@ -105,8 +103,6 @@ public function fixturize(TestCase $test): void } /** - * Get the loaded fixtures. - * * @return \Cake\Datasource\FixtureInterface[] */ public function loaded(): array @@ -114,6 +110,22 @@ public function loaded(): array return $this->_loaded; } + /** + * @return array + */ + public function getInserted(): array + { + $inserted = []; + foreach ($this->_insertionMap as $fixtures) { + foreach ($fixtures as $fixture) { + /** @var \Cake\TestSuite\Fixture\TestFixture $fixture */ + $inserted[] = $fixture->table; + } + } + + return $inserted; + } + /** * Add aliases for all non test prefixed connections. * @@ -235,7 +247,7 @@ protected function _loadFixtures(TestCase $test): void * * @param \Cake\Datasource\FixtureInterface $fixture the fixture object to create * @param \Cake\Datasource\ConnectionInterface $db The Connection object instance to use - * @param string[] $sources The existing tables in the datasource. + * @param array $sources The existing tables in the datasource. * @param bool $drop whether drop the fixture if it is already created or not * @return void */ @@ -269,11 +281,8 @@ protected function _setupTable( } /** - * Creates the fixtures tables and inserts data on them. - * - * @param \Cake\TestSuite\TestCase $test The test to inspect for fixture loading. + * @param \Cake\TestSuite\TestCase $test Test case * @return void - * @throws \Cake\Core\Exception\CakeException When fixture records cannot be inserted. * @throws \RuntimeException */ public function load(TestCase $test): void @@ -285,12 +294,10 @@ public function load(TestCase $test): void try { $createTables = function (ConnectionInterface $db, array $fixtures) use ($test): void { - /** @var \Cake\Datasource\FixtureInterface[] $fixtures */ + /** @var array<\Cake\Datasource\FixtureInterface> $fixtures */ $tables = $db->getSchemaCollection()->listTables(); $configName = $db->configName(); - if (!isset($this->_insertionMap[$configName])) { - $this->_insertionMap[$configName] = []; - } + $this->_insertionMap[$configName] = $this->_insertionMap[$configName] ?? []; foreach ($fixtures as $fixture) { if (!$fixture instanceof ConstraintsInterface) { @@ -370,7 +377,7 @@ public function load(TestCase $test): void /** * Run a function on each connection and collection of fixtures. * - * @param string[] $fixtures A list of fixtures to operate on. + * @param array $fixtures A list of fixtures to operate on. * @param callable $operation The operation to run on each connection + fixture set. * @return void */ @@ -398,7 +405,7 @@ protected function _runOperation(array $fixtures, callable $operation): void /** * Get the unique list of connections that a set of fixtures contains. * - * @param string[] $fixtures The array of fixtures a list of connections is needed from. + * @param array $fixtures The array of fixtures a list of connections is needed from. * @return array An array of connection names. */ protected function _fixtureConnections(array $fixtures): array @@ -429,7 +436,7 @@ public function unload(TestCase $test): void $truncate = function (ConnectionInterface $db, array $fixtures): void { $configName = $db->configName(); - foreach ($fixtures as $name => $fixture) { + foreach ($fixtures as $fixture) { if ( $this->isFixtureSetup($configName, $fixture) && $fixture instanceof ConstraintsInterface @@ -442,14 +449,11 @@ public function unload(TestCase $test): void } /** - * Creates a single fixture table and loads data into it. - * - * @param string $name of the fixture - * @param \Cake\Datasource\ConnectionInterface|null $connection Connection instance or null - * to get a Connection from the fixture. - * @param bool $dropTables Whether or not tables should be dropped and re-created. + * @param string $name Name + * @param \Cake\Datasource\ConnectionInterface|null $connection Connection + * @param bool $dropTables Drop all tables prior to loading schema files * @return void - * @throws \UnexpectedValueException if $name is not a previously loaded class + * @throws \UnexpectedValueException */ public function loadSingle(string $name, ?ConnectionInterface $connection = null, bool $dropTables = true): void { @@ -502,7 +506,7 @@ public function shutDown(): void } /** - * Check whether or not a fixture has been inserted in a given connection name. + * Check whether a fixture has been inserted in a given connection name. * * @param string $connection The connection name. * @param \Cake\Datasource\FixtureInterface $fixture The fixture to check. diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/Fixture/TestFixture.php b/app/vendor/cakephp/cakephp/src/TestSuite/Fixture/TestFixture.php index f5127702..a4f0fde8 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/Fixture/TestFixture.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/Fixture/TestFixture.php @@ -53,7 +53,7 @@ class TestFixture implements ConstraintsInterface, FixtureInterface, TableSchema /** * Fields / Schema for the fixture. * - * This array should be compatible with Cake\Database\Schema\Schema. + * This array should be compatible with {@link \Cake\Database\Schema\Schema}. * The `_constraints`, `_options` and `_indexes` keys are reserved for defining * constraints, options and indexes respectively. * @@ -90,7 +90,7 @@ class TestFixture implements ConstraintsInterface, FixtureInterface, TableSchema /** * Fixture constraints to be created. * - * @var array + * @var array */ protected $_constraints = []; @@ -165,11 +165,7 @@ protected function _tableFromClass(): string { [, $class] = namespaceSplit(static::class); preg_match('/^(.*)Fixture$/', $class, $matches); - $table = $class; - - if (isset($matches[1])) { - $table = $matches[1]; - } + $table = $matches[1] ?? $class; return Inflector::tableize($table); } @@ -249,20 +245,23 @@ protected function _schemaFromImport(): void protected function _schemaFromReflection(): void { $db = ConnectionManager::get($this->connection()); - $schemaCollection = $db->getSchemaCollection(); - $tables = $schemaCollection->listTables(); + try { + $name = Inflector::camelize($this->table); + $ormTable = $this->fetchTable($name, ['connection' => $db]); - if (!in_array($this->table, $tables, true)) { - throw new CakeException( - sprintf( - 'Cannot describe schema for table `%s` for fixture `%s`: the table does not exist.', - $this->table, - static::class - ) + /** @var \Cake\Database\Schema\TableSchema $schema */ + $schema = $ormTable->getSchema(); + $this->_schema = $schema; + + $this->getTableLocator()->clear(); + } catch (CakeException $e) { + $message = sprintf( + 'Cannot describe schema for table `%s` for fixture `%s`. The table does not exist.', + $this->table, + static::class ); + throw new CakeException($message, null, $e); } - - $this->_schema = $schemaCollection->describe($this->table); } /** @@ -270,7 +269,8 @@ protected function _schemaFromReflection(): void */ public function create(ConnectionInterface $connection): bool { - if (empty($this->_schema)) { + /** @psalm-suppress RedundantPropertyInitializationCheck */ + if (!isset($this->_schema)) { return false; } @@ -306,7 +306,8 @@ public function create(ConnectionInterface $connection): bool */ public function drop(ConnectionInterface $connection): bool { - if (empty($this->_schema)) { + /** @psalm-suppress RedundantPropertyInitializationCheck */ + if (!isset($this->_schema)) { return false; } @@ -332,7 +333,7 @@ public function drop(ConnectionInterface $connection): bool */ public function insert(ConnectionInterface $connection) { - if (isset($this->records) && !empty($this->records)) { + if (!empty($this->records)) { [$fields, $values, $types] = $this->_getRecords(); $query = $connection->newQuery() ->insert($fields, $types) diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/IntegrationTestTrait.php b/app/vendor/cakephp/cakephp/src/TestSuite/IntegrationTestTrait.php index 929cc79e..04973d03 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/IntegrationTestTrait.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/IntegrationTestTrait.php @@ -142,7 +142,7 @@ trait IntegrationTestTrait protected $_requestSession; /** - * Boolean flag for whether or not the request should have + * Boolean flag for whether the request should have * a SecurityComponent token added. * * @var bool @@ -150,7 +150,7 @@ trait IntegrationTestTrait protected $_securityToken = false; /** - * Boolean flag for whether or not the request should have + * Boolean flag for whether the request should have * a CSRF token added. * * @var bool @@ -158,7 +158,7 @@ trait IntegrationTestTrait protected $_csrfToken = false; /** - * Boolean flag for whether or not the request should re-store + * Boolean flag for whether the request should re-store * flash messages * * @var bool @@ -180,10 +180,17 @@ trait IntegrationTestTrait /** * List of fields that are excluded from field validation. * - * @var string[] + * @var array */ protected $_unlockedFields = []; + /** + * The name that will be used when retrieving the csrf token. + * + * @var string + */ + protected $_csrfKeyName = 'csrfToken'; + /** * Clears the state used for requests. * @@ -223,7 +230,7 @@ public function enableSecurityToken(): void /** * Set list of fields that are excluded from field validation. * - * @param string[] $unlockedFields List of fields that are excluded from field validation. + * @param array $unlockedFields List of fields that are excluded from field validation. * @return void */ public function setUnlockedFields(array $unlockedFields = []): void @@ -237,11 +244,13 @@ public function setUnlockedFields(array $unlockedFields = []): void * Both the POST data and cookie will be populated when this option * is enabled. The default parameter names will be used. * + * @param string $cookieName The name of the csrf token cookie. * @return void */ - public function enableCsrfToken(): void + public function enableCsrfToken(string $cookieName = 'csrfToken'): void { $this->_csrfToken = true; + $this->_csrfKeyName = $cookieName; } /** @@ -262,6 +271,7 @@ public function enableRetainFlashMessages(): void * * You can call this method multiple times to append into * the current state. + * Sub-keys like 'headers' will be reset, though. * * @param array $data The request data to use. * @return void @@ -315,11 +325,7 @@ public function cookie(string $name, $value): void */ protected function _getCookieEncryptionKey(): string { - if (isset($this->_cookieEncryptionKey)) { - return $this->_cookieEncryptionKey; - } - - return Security::getSalt(); + return $this->_cookieEncryptionKey ?? Security::getSalt(); } /** @@ -349,7 +355,7 @@ public function cookieEncrypted(string $name, $value, $encrypt = 'aes', $key = n * a property. You can use various assert methods to check the * response. * - * @param string|array $url The URL to request. + * @param array|string $url The URL to request. * @return void */ public function get($url): void @@ -364,8 +370,8 @@ public function get($url): void * a property. You can use various assert methods to check the * response. * - * @param string|array $url The URL to request. - * @param string|array $data The data for the request. + * @param array|string $url The URL to request. + * @param array|string $data The data for the request. * @return void */ public function post($url, $data = []): void @@ -380,8 +386,8 @@ public function post($url, $data = []): void * a property. You can use various assert methods to check the * response. * - * @param string|array $url The URL to request. - * @param string|array $data The data for the request. + * @param array|string $url The URL to request. + * @param array|string $data The data for the request. * @return void */ public function patch($url, $data = []): void @@ -396,8 +402,8 @@ public function patch($url, $data = []): void * a property. You can use various assert methods to check the * response. * - * @param string|array $url The URL to request. - * @param string|array $data The data for the request. + * @param array|string $url The URL to request. + * @param array|string $data The data for the request. * @return void */ public function put($url, $data = []): void @@ -412,7 +418,7 @@ public function put($url, $data = []): void * a property. You can use various assert methods to check the * response. * - * @param string|array $url The URL to request. + * @param array|string $url The URL to request. * @return void */ public function delete($url): void @@ -427,7 +433,7 @@ public function delete($url): void * a property. You can use various assert methods to check the * response. * - * @param string|array $url The URL to request. + * @param array|string $url The URL to request. * @return void */ public function head($url): void @@ -442,7 +448,7 @@ public function head($url): void * a property. You can use various assert methods to check the * response. * - * @param string|array $url The URL to request. + * @param array|string $url The URL to request. * @return void */ public function options($url): void @@ -455,9 +461,9 @@ public function options($url): void * * Receives and stores the response for future inspection. * - * @param string|array $url The URL + * @param array|string $url The URL * @param string $method The HTTP method - * @param string|array $data The request data. + * @param array|string $data The request data. * @return void * @throws \PHPUnit\Exception|\Throwable */ @@ -559,7 +565,7 @@ protected function _handleError(Throwable $exception): void * * @param string $url The URL * @param string $method The HTTP method - * @param string|array $data The request data. + * @param array|string $data The request data. * @return array The request context */ protected function _buildRequest(string $url, $method, $data = []): array @@ -654,21 +660,20 @@ protected function _addTokens(string $url, array $data): array if ($this->_csrfToken === true) { $middleware = new CsrfProtectionMiddleware(); - $token = null; - if (!isset($this->_cookie['csrfToken']) && !isset($this->_session['csrfToken'])) { + if (!isset($this->_cookie[$this->_csrfKeyName]) && !isset($this->_session[$this->_csrfKeyName])) { $token = $middleware->createToken(); - } elseif (isset($this->_cookie['csrfToken'])) { - $token = $this->_cookie['csrfToken']; + } elseif (isset($this->_cookie[$this->_csrfKeyName])) { + $token = $this->_cookie[$this->_csrfKeyName]; } else { - $token = $this->_session['csrfToken']; + $token = $this->_session[$this->_csrfKeyName]; } // Add the token to both the session and cookie to cover // both types of CSRF tokens. We generate the token with the cookie // middleware as cookie tokens will be accepted by session csrf, but not // the inverse. - $this->_session['csrfToken'] = $token; - $this->_cookie['csrfToken'] = $token; + $this->_session[$this->_csrfKeyName] = $token; + $this->_cookie[$this->_csrfKeyName] = $token; if (!isset($data['_csrfToken'])) { $data['_csrfToken'] = $token; } @@ -817,7 +822,7 @@ public function assertResponseCode(int $code, string $message = ''): void /** * Asserts that the Location header is correct. Comparison is made against a full URL. * - * @param string|array|null $url The URL you expected the client to go to. This + * @param array|string|null $url The URL you expected the client to go to. This * can either be a string URL or an array compatible with Router::url(). Use null to * simply check for the existence of this header. * @param string $message The failure message that will be appended to the generated message. @@ -844,7 +849,7 @@ public function assertRedirect($url = null, $message = ''): void /** * Asserts that the Location header is correct. Comparison is made against exactly the URL provided. * - * @param string|array|null $url The URL you expected the client to go to. This + * @param array|string|null $url The URL you expected the client to go to. This * can either be a string URL or an array compatible with Router::url(). Use null to * simply check for the existence of this header. * @param string $message The failure message that will be appended to the generated message. @@ -1358,6 +1363,7 @@ protected function extractExceptionMessage(Exception $exception): string */ protected function getSession(): TestSession { + /** @psalm-suppress InvalidScalarArgument */ return new TestSession($_SESSION); } } diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/LegacyCommandRunner.php b/app/vendor/cakephp/cakephp/src/TestSuite/LegacyCommandRunner.php index ce5ae9d4..33dca5c3 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/LegacyCommandRunner.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/LegacyCommandRunner.php @@ -27,7 +27,7 @@ class LegacyCommandRunner * Mimics functionality of Cake\Console\CommandRunner * * @param array $argv Argument array - * @param \Cake\Console\ConsoleIo $io A ConsoleIo instance. + * @param \Cake\Console\ConsoleIo|null $io A ConsoleIo instance. * @return int */ public function run(array $argv, ?ConsoleIo $io = null): int diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/LegacyShellDispatcher.php b/app/vendor/cakephp/cakephp/src/TestSuite/LegacyShellDispatcher.php index 4f987cb0..dcf258c8 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/LegacyShellDispatcher.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/LegacyShellDispatcher.php @@ -34,7 +34,7 @@ class LegacyShellDispatcher extends ShellDispatcher * * @param array $args Argument array * @param bool $bootstrap Initialize environment - * @param \Cake\Console\ConsoleIo $io ConsoleIo + * @param \Cake\Console\ConsoleIo|null $io ConsoleIo */ public function __construct(array $args = [], bool $bootstrap = true, ?ConsoleIo $io = null) { diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/MiddlewareDispatcher.php b/app/vendor/cakephp/cakephp/src/TestSuite/MiddlewareDispatcher.php index 7deff01f..f9ce0efe 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/MiddlewareDispatcher.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/MiddlewareDispatcher.php @@ -98,7 +98,7 @@ protected function resolveRoute(array $url): string /** * Create a PSR7 request from the request spec. * - * @param array $spec The request spec. + * @param array $spec The request spec. * @return \Cake\Http\ServerRequest */ protected function _createRequest(array $spec): ServerRequest @@ -131,7 +131,7 @@ protected function _createRequest(array $spec): ServerRequest /** * Run a request and get the response. * - * @param array $requestSpec The request spec to execute. + * @param array $requestSpec The request spec to execute. * @return \Psr\Http\Message\ResponseInterface The generated response. * @throws \LogicException */ diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/Stub/ConsoleInput.php b/app/vendor/cakephp/cakephp/src/TestSuite/Stub/ConsoleInput.php index 2d03cb22..80cd376e 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/Stub/ConsoleInput.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/Stub/ConsoleInput.php @@ -29,7 +29,7 @@ class ConsoleInput extends ConsoleInputBase /** * Reply values for ask() and askChoice() * - * @var string[] + * @var array */ protected $replies = []; @@ -43,7 +43,7 @@ class ConsoleInput extends ConsoleInputBase /** * Constructor * - * @param string[] $replies A list of replies for read() + * @param array $replies A list of replies for read() */ public function __construct(array $replies) { diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/Stub/ConsoleOutput.php b/app/vendor/cakephp/cakephp/src/TestSuite/Stub/ConsoleOutput.php index ac55fcca..24ee50d1 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/Stub/ConsoleOutput.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/Stub/ConsoleOutput.php @@ -36,14 +36,14 @@ class ConsoleOutput extends ConsoleOutputBase /** * Buffered messages. * - * @var array + * @var array */ protected $_out = []; /** * Write output to the buffer. * - * @param string|string[] $message A string or an array of strings to output + * @param array|string $message A string or an array of strings to output * @param int $newlines Number of newlines to append * @return int */ @@ -65,7 +65,7 @@ public function write($message, int $newlines = 1): int /** * Get the buffered output. * - * @return array + * @return array */ public function messages(): array { diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/TestCase.php b/app/vendor/cakephp/cakephp/src/TestSuite/TestCase.php index 2d40cda1..90635aed 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/TestCase.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/TestCase.php @@ -27,6 +27,8 @@ use Cake\Routing\Router; use Cake\TestSuite\Constraint\EventFired; use Cake\TestSuite\Constraint\EventFiredWith; +use Cake\TestSuite\Fixture\FixtureStrategyInterface; +use Cake\TestSuite\Fixture\TruncateStrategy; use Cake\Utility\Inflector; use LogicException; use PHPUnit\Framework\Constraint\DirectoryExists; @@ -50,12 +52,12 @@ abstract class TestCase extends BaseTestCase * * @var \Cake\TestSuite\Fixture\FixtureManager|null */ - public $fixtureManager; + public static $fixtureManager; /** * Fixtures used by this test case. * - * @var string[] + * @var array */ protected $fixtures = []; @@ -64,6 +66,8 @@ abstract class TestCase extends BaseTestCase * Set this to false to handle manually * * @var bool + * @deprecated 4.3.0 autoFixtures is only used by deprecated fixture features. + * This property will be removed in 5.0 */ public $autoFixtures = true; @@ -74,9 +78,16 @@ abstract class TestCase extends BaseTestCase * end of each test runner execution. * * @var bool + * @deprecated 4.3.0 dropTables is only used by deprecated fixture features. + * This property will be removed in 5.0 */ public $dropTables = false; + /** + * @var \Cake\TestSuite\Fixture\FixtureStrategyInterface|null + */ + protected $fixtureStrategy = null; + /** * Configure values to restore at end of test. * @@ -153,7 +164,7 @@ public static function assertDirectoryDoesNotExist(string $directory, string $me /** * Overrides SimpleTestCase::skipIf to provide a boolean return value * - * @param bool $shouldSkip Whether or not the test should be skipped. + * @param bool $shouldSkip Whether the test should be skipped. * @param string $message The message to display. * @return bool */ @@ -192,13 +203,37 @@ public function withErrorReporting(int $errorLevel, callable $callable): void */ public function deprecated(callable $callable): void { - $errorLevel = error_reporting(); - error_reporting(E_ALL ^ E_USER_DEPRECATED); + $duplicate = Configure::read('Error.allowDuplicateDeprecations'); + Configure::write('Error.allowDuplicateDeprecations', true); + /** @var bool $deprecation */ + $deprecation = false; + + /** + * @psalm-suppress InvalidArgument + */ + $previousHandler = set_error_handler( + function ($code, $message, $file, $line, $context = null) use (&$previousHandler, &$deprecation): bool { + if ($code == E_USER_DEPRECATED) { + $deprecation = true; + + return true; + } + if ($previousHandler) { + return $previousHandler($code, $message, $file, $line, $context); + } + + return false; + } + ); try { $callable(); } finally { - error_reporting($errorLevel); + restore_error_handler(); + if ($duplicate !== Configure::read('Error.allowDuplicateDeprecations')) { + Configure::write('Error.allowDuplicateDeprecations', $duplicate); + } } + $this->assertTrue($deprecation, 'Should have at least one deprecation warning'); } /** @@ -211,6 +246,7 @@ public function deprecated(callable $callable): void protected function setUp(): void { parent::setUp(); + $this->setupFixtures(); if (!$this->_configure) { $this->_configure = Configure::read(); @@ -230,6 +266,8 @@ protected function setUp(): void protected function tearDown(): void { parent::tearDown(); + $this->teardownFixtures(); + if ($this->_configure) { Configure::clear(); Configure::write($this->_configure); @@ -237,7 +275,53 @@ protected function tearDown(): void $this->getTableLocator()->clear(); $this->_configure = []; $this->_tableLocator = null; - $this->fixtureManager = null; + } + + /** + * Initialized and loads any use fixtures. + * + * @return void + */ + protected function setupFixtures(): void + { + $fixtureNames = $this->getFixtures(); + + if (!empty($fixtureNames) && static::$fixtureManager) { + if (!$this->autoFixtures) { + deprecationWarning('`$autoFixtures` is deprecated and will be removed in 5.0.', 0); + } + if ($this->dropTables) { + deprecationWarning('`$dropTables` is deprecated and will be removed in 5.0.', 0); + } + // legacy fixtures are managed by FixtureInjector + return; + } + + $this->fixtureStrategy = $this->getFixtureStrategy(); + $this->fixtureStrategy->setupTest($fixtureNames); + } + + /** + * Unloads any use fixtures. + * + * @return void + */ + protected function teardownFixtures(): void + { + if ($this->fixtureStrategy) { + $this->fixtureStrategy->teardownTest(); + $this->fixtureStrategy = null; + } + } + + /** + * Returns fixture strategy used by these tests. + * + * @return \Cake\TestSuite\Fixture\FixtureStrategyInterface + */ + protected function getFixtureStrategy(): FixtureStrategyInterface + { + return new TruncateStrategy(); } /** @@ -249,25 +333,26 @@ protected function tearDown(): void * @return void * @see \Cake\TestSuite\TestCase::$autoFixtures * @throws \RuntimeException when no fixture manager is available. + * @deprecated 4.3.0 Disabling auto-fixtures is deprecated and only available using FixtureInjector fixture system. */ public function loadFixtures(): void { if ($this->autoFixtures) { throw new RuntimeException('Cannot use `loadFixtures()` with `$autoFixtures` enabled.'); } - if ($this->fixtureManager === null) { + if (static::$fixtureManager === null) { throw new RuntimeException('No fixture manager to load the test fixture'); } $args = func_get_args(); foreach ($args as $class) { - $this->fixtureManager->loadSingle($class, null, $this->dropTables); + static::$fixtureManager->loadSingle($class, null, $this->dropTables); } if (empty($args)) { $autoFixtures = $this->autoFixtures; $this->autoFixtures = true; - $this->fixtureManager->load($this); + static::$fixtureManager->load($this); $this->autoFixtures = $autoFixtures; } } @@ -306,7 +391,7 @@ public function loadRoutes(?array $appArgs = null): void * Useful to test how plugins being loaded/not loaded interact with other * elements in CakePHP or applications. * - * @param array $plugins List of Plugins to load. + * @param array $plugins List of Plugins to load. * @return \Cake\Http\BaseApplication */ public function loadPlugins(array $plugins = []): BaseApplication @@ -336,7 +421,7 @@ public function loadPlugins(array $plugins = []): BaseApplication * * Useful in test case teardown methods. * - * @param string[] $names A list of plugins you want to remove. + * @param array $names A list of plugins you want to remove. * @return void */ public function removePlugins(array $names = []): void @@ -503,7 +588,7 @@ public function assertTextEndsNotWith(string $suffix, string $string, string $me * @param string $needle The string to search for. * @param string $haystack The string to search through. * @param string $message The message to display on failure. - * @param bool $ignoreCase Whether or not the search should be case-sensitive. + * @param bool $ignoreCase Whether the search should be case-sensitive. * @return void */ public function assertTextContains( @@ -529,7 +614,7 @@ public function assertTextContains( * @param string $needle The string to search for. * @param string $haystack The string to search through. * @param string $message The message to display on failure. - * @param bool $ignoreCase Whether or not the search should be case-sensitive. + * @param bool $ignoreCase Whether the search should be case-sensitive. * @return void */ public function assertTextNotContains( @@ -624,7 +709,7 @@ public function assertRegExpSql(string $pattern, string $actual, bool $optional * * @param array $expected An array, see above * @param string $string An HTML/XHTML/XML string - * @param bool $fullDebug Whether or not more verbose output should be used. + * @param bool $fullDebug Whether more verbose output should be used. * @return bool */ public function assertHtml(array $expected, string $string, bool $fullDebug = false): bool @@ -733,6 +818,9 @@ public function assertHtml(array $expected, string $string, bool $fullDebug = fa ]; } } + /** + * @var array $assertion + */ foreach ($regex as $i => $assertion) { $matches = false; if (isset($assertion['attrs'])) { @@ -779,9 +867,9 @@ public function assertHtml(array $expected, string $string, bool $fullDebug = fa /** * Check the attributes as part of an assertTags() check. * - * @param array $assertions Assertions to run. + * @param array $assertions Assertions to run. * @param string $string The HTML string to check. - * @param bool $fullDebug Whether or not more verbose output should be used. + * @param bool $fullDebug Whether more verbose output should be used. * @param array|string $regex Full regexp from `assertHtml` * @return string|false */ @@ -896,8 +984,8 @@ protected function skipUnless($condition, $message = '') * Mock a model, maintain fixtures and table association * * @param string $alias The model to get a mock for. - * @param string[] $methods The list of methods to mock - * @param array $options The config data for the mock's constructor. + * @param array $methods The list of methods to mock + * @param array $options The config data for the mock's constructor. * @throws \Cake\ORM\Exception\MissingTableClassException * @return \Cake\ORM\Table|\PHPUnit\Framework\MockObject\MockObject */ @@ -957,7 +1045,7 @@ public function getMockForModel(string $alias, array $methods = [], array $optio * Gets the class name for the table. * * @param string $alias The model to get a mock for. - * @param array $options The config data for the mock's constructor. + * @param array $options The config data for the mock's constructor. * @return string * @throws \Cake\ORM\Exception\MissingTableClassException * @psalm-return class-string<\Cake\ORM\Table> @@ -1013,9 +1101,9 @@ protected function addFixture(string $fixture) } /** - * Gets fixtures. + * Get the fixtures this test should use. * - * @return string[] + * @return array */ public function getFixtures(): array { diff --git a/app/vendor/cakephp/cakephp/src/TestSuite/TestEmailTransport.php b/app/vendor/cakephp/cakephp/src/TestSuite/TestEmailTransport.php index 1843c1a0..8d2694d7 100644 --- a/app/vendor/cakephp/cakephp/src/TestSuite/TestEmailTransport.php +++ b/app/vendor/cakephp/cakephp/src/TestSuite/TestEmailTransport.php @@ -68,7 +68,7 @@ public static function replaceAllTransports(): void /** * Gets emails sent * - * @return \Cake\Mailer\Message[] + * @return array<\Cake\Mailer\Message> */ public static function getMessages() { diff --git a/app/vendor/cakephp/cakephp/src/Utility/CookieCryptTrait.php b/app/vendor/cakephp/cakephp/src/Utility/CookieCryptTrait.php index afe10e02..a57bfc03 100644 --- a/app/vendor/cakephp/cakephp/src/Utility/CookieCryptTrait.php +++ b/app/vendor/cakephp/cakephp/src/Utility/CookieCryptTrait.php @@ -30,7 +30,7 @@ trait CookieCryptTrait /** * Valid cipher names for encrypted cookies. * - * @var string[] + * @var array */ protected $_validCiphers = ['aes']; @@ -44,7 +44,7 @@ abstract protected function _getCookieEncryptionKey(): string; /** * Encrypts $value using public $type method in Security class * - * @param string|array $value Value to encrypt + * @param array|string $value Value to encrypt * @param string|false $encrypt Encryption mode to use. False * disabled encryption. * @param string|null $key Used as the security salt if specified. @@ -92,10 +92,10 @@ protected function _checkCipher(string $encrypt): void /** * Decrypts $value using public $type method in Security class * - * @param string[]|string $values Values to decrypt + * @param array|string $values Values to decrypt * @param string|false $mode Encryption mode * @param string|null $key Used as the security salt if specified. - * @return string|array Decrypted values + * @return array|string Decrypted values */ protected function _decrypt($values, $mode, ?string $key = null) { @@ -117,7 +117,7 @@ protected function _decrypt($values, $mode, ?string $key = null) * @param string $value The value to decode & decrypt. * @param string|false $encrypt The encryption cipher to use. * @param string|null $key Used as the security salt if specified. - * @return string|array Decoded values. + * @return array|string Decoded values. */ protected function _decode(string $value, $encrypt, ?string $key) { @@ -168,7 +168,7 @@ protected function _implode(array $array): string * Maintains reading backwards compatibility with 1.x CookieComponent::_implode(). * * @param string $string A string containing JSON encoded data, or a bare string. - * @return string|array Map of key and values + * @return array|string Map of key and values */ protected function _explode(string $string) { diff --git a/app/vendor/cakephp/cakephp/src/Utility/Crypto/OpenSsl.php b/app/vendor/cakephp/cakephp/src/Utility/Crypto/OpenSsl.php index 044bf3f6..99590d38 100644 --- a/app/vendor/cakephp/cakephp/src/Utility/Crypto/OpenSsl.php +++ b/app/vendor/cakephp/cakephp/src/Utility/Crypto/OpenSsl.php @@ -20,7 +20,7 @@ * OpenSSL implementation of crypto features for Cake\Utility\Security * * This class is not intended to be used directly and should only - * be used in the context of Cake\Utility\Security. + * be used in the context of {@link \Cake\Utility\Security}. * * @internal */ diff --git a/app/vendor/cakephp/cakephp/src/Utility/Hash.php b/app/vendor/cakephp/cakephp/src/Utility/Hash.php index 82754014..af52e903 100644 --- a/app/vendor/cakephp/cakephp/src/Utility/Hash.php +++ b/app/vendor/cakephp/cakephp/src/Utility/Hash.php @@ -37,9 +37,9 @@ class Hash * Does not support the full dot notation feature set, * but is faster for simple read operations. * - * @param array|\ArrayAccess $data Array of data or object implementing + * @param \ArrayAccess|array $data Array of data or object implementing * \ArrayAccess interface to operate on. - * @param string|int|string[]|null $path The path being searched for. Either a dot + * @param array|string|int|null $path The path being searched for. Either a dot * separated string, or an array of path segments. * @param mixed $default The return value when the path does not exist * @throws \InvalidArgumentException @@ -116,9 +116,9 @@ public static function get($data, $path, $default = null) * - `{n}.User[username=/^paul/]` Get User elements with username matching `^paul`. * - `{n}.User[id=1].name` Get the Users name with id matching `1`. * - * @param array|\ArrayAccess $data The data to extract from. + * @param \ArrayAccess|array $data The data to extract from. * @param string $path The path to extract. - * @return array|\ArrayAccess An array of the extracted values. Returns an empty array + * @return \ArrayAccess|array An array of the extracted values. Returns an empty array * if there are no matches. * @link https://book.cakephp.org/4/en/core-libraries/hash.html#Cake\Utility\Hash::extract */ @@ -233,9 +233,9 @@ protected static function _matchToken($key, string $token): bool } /** - * Checks whether or not $data matches the attribute patterns + * Checks whether $data matches the attribute patterns * - * @param array|\ArrayAccess $data Array of data to match. + * @param \ArrayAccess|array $data Array of data to match. * @param string $selector The patterns to match. * @return bool Fitness of expression. */ @@ -268,10 +268,7 @@ protected static function _matches($data, string $selector): bool return false; } - $prop = ''; - if (isset($data[$attr])) { - $prop = $data[$attr]; - } + $prop = $data[$attr] ?? ''; $isBool = is_bool($prop); if ($isBool && is_numeric($val)) { $prop = $prop ? '1' : '0'; @@ -355,7 +352,7 @@ public static function insert(array $data, string $path, $values = null): array * * @param string $op The operation to do. * @param array $data The data to operate on. - * @param string[] $path The path to work on. + * @param array $path The path to work on. * @param mixed $values The values to insert when doing inserts. * @return array data. */ @@ -372,9 +369,7 @@ protected static function _simpleOp(string $op, array $data, array $path, $value return $data; } - if (!isset($_list[$key])) { - $_list[$key] = []; - } + $_list[$key] = $_list[$key] ?? []; $_list = &$_list[$key]; if (!is_array($_list)) { $_list = []; @@ -461,8 +456,8 @@ public static function remove(array $data, string $path): array * following the path specified in `$groupPath`. * * @param array $data Array from where to extract keys and values - * @param string|string[]|null $keyPath A dot-separated string. - * @param string|string[]|null $valuePath A dot-separated string. + * @param array|string|null $keyPath A dot-separated string. + * @param array|string|null $valuePath A dot-separated string. * @param string|null $groupPath A dot-separated string. * @return array Combined array * @link https://book.cakephp.org/4/en/core-libraries/hash.html#Cake\Utility\Hash::combine @@ -513,12 +508,8 @@ public static function combine(array $data, $keyPath, $valuePath = null, ?string $c = is_array($keys) ? count($keys) : count($vals); $out = []; for ($i = 0; $i < $c; $i++) { - if (!isset($group[$i])) { - $group[$i] = 0; - } - if (!isset($out[$group[$i]])) { - $out[$group[$i]] = []; - } + $group[$i] = $group[$i] ?? 0; + $out[$group[$i]] = $out[$group[$i]] ?? []; if ($keys === null) { $out[$group[$i]][] = $vals[$i]; } else { @@ -549,9 +540,9 @@ public static function combine(array $data, $keyPath, $valuePath = null, ?string * The `$format` string can use any format options that `vsprintf()` and `sprintf()` do. * * @param array $data Source array from which to extract the data - * @param string[] $paths An array containing one or more Hash::extract()-style key paths + * @param array $paths An array containing one or more Hash::extract()-style key paths * @param string $format Format string into which values will be inserted, see sprintf() - * @return string[]|null An array of strings extracted from `$path` and formatted with `$format` + * @return array|null An array of strings extracted from `$path` and formatted with `$format` * @link https://book.cakephp.org/4/en/core-libraries/hash.html#Cake\Utility\Hash::format * @see sprintf() * @see \Cake\Utility\Hash::extract() @@ -627,7 +618,7 @@ public static function contains(array $data, array $needle): bool } /** - * Test whether or not a given path exists in $data. + * Test whether a given path exists in $data. * This method uses the same path syntax as Hash::extract() * * Checking for paths that could target more than one element will @@ -658,7 +649,7 @@ public static function check(array $data, string $path): bool * @return array Filtered array * @link https://book.cakephp.org/4/en/core-libraries/hash.html#Cake\Utility\Hash::filter */ - public static function filter(array $data, $callback = ['self', '_filter']): array + public static function filter(array $data, $callback = [Hash::class, '_filter']): array { foreach ($data as $k => $v) { if (is_array($v)) { @@ -729,6 +720,7 @@ public static function flatten(array $data, string $separator = '.'): array * into a multi-dimensional array. So, `['0.Foo.Bar' => 'Far']` becomes * `[['Foo' => ['Bar' => 'Far']]]`. * + * @phpstan-param non-empty-string $separator * @param array $data Flattened array * @param string $separator The delimiter used * @return array @@ -985,7 +977,7 @@ public static function apply(array $data, string $path, callable $function) * @param array $data An array of data to sort * @param string $path A Set-compatible path to the array value * @param string|int $dir See directions above. Defaults to 'asc'. - * @param array|string $type See direction types above. Defaults to 'regular'. + * @param array|string $type See direction types above. Defaults to 'regular'. * @return array Sorted array of data * @link https://book.cakephp.org/4/en/core-libraries/hash.html#Cake\Utility\Hash::sort */ @@ -1204,8 +1196,8 @@ public static function normalize(array $data, bool $assoc = true): array * - `root` The id of the desired top-most result. * * @param array $data The data to nest. - * @param array $options Options are: - * @return array[] of results, nested + * @param array $options Options are: + * @return array of results, nested * @see \Cake\Utility\Hash::extract() * @throws \InvalidArgumentException When providing invalid data. * @link https://book.cakephp.org/4/en/core-libraries/hash.html#Cake\Utility\Hash::nest diff --git a/app/vendor/cakephp/cakephp/src/Utility/Inflector.php b/app/vendor/cakephp/cakephp/src/Utility/Inflector.php index 73eed4c1..33438c34 100644 --- a/app/vendor/cakephp/cakephp/src/Utility/Inflector.php +++ b/app/vendor/cakephp/cakephp/src/Utility/Inflector.php @@ -29,7 +29,7 @@ class Inflector /** * Plural inflector rules * - * @var array + * @var array */ protected static $_plural = [ '/(s)tatus$/i' => '\1tatuses', @@ -60,7 +60,7 @@ class Inflector /** * Singular inflector rules * - * @var array + * @var array */ protected static $_singular = [ '/(s)tatuses$/i' => '\1\2tatus', @@ -69,7 +69,7 @@ class Inflector '/(matr)ices$/i' => '\1ix', '/(vert|ind)ices$/i' => '\1ex', '/^(ox)en/i' => '\1', - '/(alias)(es)*$/i' => '\1', + '/(alias|lens)(es)*$/i' => '\1', '/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|viri?)i$/i' => '\1us', '/([ftw]ax)es/i' => '\1', '/(cris|ax|test)es$/i' => '\1is', @@ -81,6 +81,7 @@ class Inflector '/(x|ch|ss|sh)es$/i' => '\1', '/(m)ovies$/i' => '\1\2ovie', '/(s)eries$/i' => '\1\2eries', + '/(s)pecies$/i' => '\1\2pecies', '/([^aeiouy]|qu)ies$/i' => '\1y', '/(tive)s$/i' => '\1', '/(hive)s$/i' => '\1', @@ -102,7 +103,7 @@ class Inflector /** * Irregular rules * - * @var array + * @var array */ protected static $_irregular = [ 'atlas' => 'atlases', @@ -152,7 +153,7 @@ class Inflector /** * Words that should not be inflected * - * @var array + * @var array */ protected static $_uninflected = [ '.*[nrlm]ese', '.*data', '.*deer', '.*fish', '.*measles', '.*ois', diff --git a/app/vendor/cakephp/cakephp/src/Utility/MergeVariablesTrait.php b/app/vendor/cakephp/cakephp/src/Utility/MergeVariablesTrait.php index 80395045..39bafb88 100644 --- a/app/vendor/cakephp/cakephp/src/Utility/MergeVariablesTrait.php +++ b/app/vendor/cakephp/cakephp/src/Utility/MergeVariablesTrait.php @@ -29,8 +29,8 @@ trait MergeVariablesTrait * - `associative` - A list of properties that should be treated as associative arrays. * Properties in this list will be passed through Hash::normalize() before merging. * - * @param string[] $properties An array of properties and the merge strategy for them. - * @param array $options The options to use when merging properties. + * @param array $properties An array of properties and the merge strategy for them. + * @param array $options The options to use when merging properties. * @return void */ protected function _mergeVars(array $properties, array $options = []): void @@ -61,8 +61,8 @@ protected function _mergeVars(array $properties, array $options = []): void * Merge a single property with the values declared in all parent classes. * * @param string $property The name of the property being merged. - * @param array $parentClasses An array of classes you want to merge with. - * @param array $options Options for merging the property, see _mergeVars() + * @param array $parentClasses An array of classes you want to merge with. + * @param array $options Options for merging the property, see _mergeVars() * @return void */ protected function _mergeProperty(string $property, array $parentClasses, array $options): void @@ -98,8 +98,8 @@ protected function _mergeProperty(string $property, array $parentClasses, array * * @param array $current The current merged value. * @param array $parent The parent class' value. - * @param bool $isAssoc Whether or not the merging should be done in associative mode. - * @return mixed The updated value. + * @param bool $isAssoc Whether the merging should be done in associative mode. + * @return array The updated value. */ protected function _mergePropertyData(array $current, array $parent, bool $isAssoc) { diff --git a/app/vendor/cakephp/cakephp/src/Utility/Security.php b/app/vendor/cakephp/cakephp/src/Utility/Security.php index 5fcdc4fc..df3952a7 100644 --- a/app/vendor/cakephp/cakephp/src/Utility/Security.php +++ b/app/vendor/cakephp/cakephp/src/Utility/Security.php @@ -110,6 +110,7 @@ public static function setHash(string $hash): void */ public static function randomBytes(int $length): string { + /** @psalm-suppress ArgumentTypeCoercion */ return random_bytes($length); } diff --git a/app/vendor/cakephp/cakephp/src/Utility/Text.php b/app/vendor/cakephp/cakephp/src/Utility/Text.php index 6b1e2523..570a2474 100644 --- a/app/vendor/cakephp/cakephp/src/Utility/Text.php +++ b/app/vendor/cakephp/cakephp/src/Utility/Text.php @@ -40,9 +40,9 @@ class Text protected static $_defaultTransliteratorId = 'Any-Latin; Latin-ASCII; [\u0080-\u7fff] remove'; /** - * Default html tags who must not be count for truncate text. + * Default HTML tags which must not be counted for truncating text. * - * @var array + * @var array */ protected static $_defaultHtmlNoCount = [ 'style', @@ -53,10 +53,10 @@ class Text * Generate a random UUID version 4 * * Warning: This method should not be used as a random seed for any cryptographic operations. - * Instead you should use the openssl or mcrypt extensions. + * Instead, you should use the openssl or mcrypt extensions. * * It should also not be used to create identifiers that have security implications, such as - * 'unguessable' URL identifiers. Instead you should use `Security::randomBytes()` for that. + * 'unguessable' URL identifiers. Instead, you should use {@link \Cake\Utility\Security::randomBytes()}` for that. * * @see https://www.ietf.org/rfc/rfc4122.txt * @return string RFC 4122 UUID @@ -92,7 +92,7 @@ public static function uuid(): string * @param string $separator The token to split the data on. * @param string $leftBound The left boundary to ignore separators in. * @param string $rightBound The right boundary to ignore separators in. - * @return string[] Array of tokens in $data. + * @return array Array of tokens in $data. */ public static function tokenize( string $data, @@ -189,7 +189,7 @@ public static function tokenize( * @param string $str A string containing variable placeholders * @param array $data A key => val array where each key stands for a placeholder variable name * to be replaced with val - * @param array $options An array of options, see description above + * @param array $options An array of options, see description above * @return string */ public static function insert(string $str, array $data, array $options = []): string @@ -259,7 +259,7 @@ public static function insert(string $str, array $data, array $options = []): st * by Text::insert(). * * @param string $str String to clean. - * @param array $options Options list. + * @param array $options Options list. * @return string * @see \Cake\Utility\Text::insert() */ @@ -330,7 +330,7 @@ public static function cleanInsert(string $str, array $options): string * - `indentAt` 0 based index to start indenting at. Defaults to 0. * * @param string $text The text to format. - * @param array|int $options Array of options to use, or an integer to wrap the text to. + * @param array|int $options Array of options to use, or an integer to wrap the text to. * @return string Formatted text. */ public static function wrap(string $text, $options = []): string @@ -367,7 +367,7 @@ public static function wrap(string $text, $options = []): string * - `indentAt` 0 based index to start indenting at. Defaults to 0. * * @param string $text The text to format. - * @param array|int $options Array of options to use, or an integer to wrap the text to. + * @param array|int $options Array of options to use, or an integer to wrap the text to. * @return string Formatted text. */ public static function wrapBlock(string $text, $options = []): string @@ -413,6 +413,7 @@ public static function wrapBlock(string $text, $options = []): string /** * Unicode and newline aware version of wordwrap. * + * @phpstan-param non-empty-string $break * @param string $text The text to format. * @param int $width The width to wrap to. Defaults to 72. * @param string $break The line is broken using the optional break parameter. Defaults to '\n'. @@ -440,8 +441,8 @@ public static function wordWrap(string $text, int $width = 72, string $break = " */ protected static function _wordWrap(string $text, int $width = 72, string $break = "\n", bool $cut = false): string { + $parts = []; if ($cut) { - $parts = []; while (mb_strlen($text) > 0) { $part = mb_substr($text, 0, $width); $parts[] = trim($part); @@ -451,7 +452,6 @@ protected static function _wordWrap(string $text, int $width = 72, string $break return implode($break, $parts); } - $parts = []; while (mb_strlen($text) > 0) { if ($width >= mb_strlen($text)) { $parts[] = trim($text); @@ -492,8 +492,8 @@ protected static function _wordWrap(string $text, int $width = 72, string $break * - `limit` A limit, optional, defaults to -1 (none) * * @param string $text Text to search the phrase in. - * @param string|array $phrase The phrase or phrases that will be searched. - * @param array $options An array of HTML attributes and options. + * @param array|string $phrase The phrase or phrases that will be searched. + * @param array $options An array of HTML attributes and options. * @return string The highlighted text * @link https://book.cakephp.org/4/en/core-libraries/text.html#highlighting-substrings */ @@ -554,7 +554,7 @@ public static function highlight(string $text, $phrase, array $options = []): st * * @param string $text String to truncate. * @param int $length Length of returned string, including ellipsis. - * @param array $options An array of options. + * @param array $options An array of options. * @return string Trimmed string. */ public static function tail(string $text, int $length = 100, array $options = []): string @@ -593,7 +593,7 @@ public static function tail(string $text, int $length = 100, array $options = [] * * @param string $text String to truncate. * @param int $length Length of returned string, including ellipsis. - * @param array $options An array of HTML attributes and options. + * @param array $options An array of HTML attributes and options. * @return string Trimmed string. * @link https://book.cakephp.org/4/en/core-libraries/text.html#truncating-text */ @@ -683,7 +683,7 @@ public static function truncate(string $text, int $length = 100, array $options } // If result is empty, then we don't need to count ellipsis in the cut. - if (!strlen($result)) { + if ($result === '') { $result = self::_substr($text, 0, $length, $options); } } @@ -696,7 +696,7 @@ public static function truncate(string $text, int $length = 100, array $options * * @param string $text String to truncate. * @param int $length Length of returned string, including ellipsis. - * @param array $options An array of HTML attributes and options. + * @param array $options An array of HTML attributes and options. * @return string Trimmed string. * @see \Cake\Utility\Text::truncate() */ @@ -714,7 +714,7 @@ public static function truncateByWidth(string $text, int $length = 100, array $o * - `trimWidth` If true, the width will return. * * @param string $text The string being checked for length - * @param array $options An array of options. + * @param array $options An array of options. * @return int */ protected static function _strlen(string $text, array $options): int @@ -754,7 +754,7 @@ function ($match) use ($strlen) { * @param string $text The input string. * @param int $start The position to begin extracting. * @param int|null $length The desired length. - * @param array $options An array of options. + * @param array $options An array of options. * @return string */ protected static function _substr(string $text, int $start, ?int $length, array $options): string @@ -912,7 +912,7 @@ public static function excerpt(string $text, string $phrase, int $radius = 100, /** * Creates a comma separated list where the last two items are joined with 'and', forming natural language. * - * @param string[] $list The list to be joined. + * @param array $list The list to be joined. * @param string|null $and The word used to join the last and second last items together with. Defaults to 'and'. * @param string $separator The separator used to join all the other items together. Defaults to ', '. * @return string The glued together string. @@ -1147,7 +1147,7 @@ public static function transliterate(string $string, $transliterator = null): st * For e.g. this option can be set to '.' to generate clean file names. * * @param string $string the string you want to slug - * @param array|string $options If string it will be use as replacement character + * @param array|string $options If string it will be use as replacement character * or an array of options. * @return string * @see setTransliterator() @@ -1177,7 +1177,7 @@ public static function slug(string $string, $options = []): string '/[' . $regex . ']/mu' => $options['replacement'], sprintf('/^[%s]+|[%s]+$/', $quotedReplacement, $quotedReplacement) => '', ]; - if (is_string($options['replacement']) && strlen($options['replacement']) > 0) { + if (is_string($options['replacement']) && $options['replacement'] !== '') { $map[sprintf('/[%s]+/mu', $quotedReplacement)] = $options['replacement']; } $string = preg_replace(array_keys($map), $map, $string); diff --git a/app/vendor/cakephp/cakephp/src/Utility/Xml.php b/app/vendor/cakephp/cakephp/src/Utility/Xml.php index a888d825..d02f5913 100644 --- a/app/vendor/cakephp/cakephp/src/Utility/Xml.php +++ b/app/vendor/cakephp/cakephp/src/Utility/Xml.php @@ -97,8 +97,8 @@ class Xml * * If using array as input, you can pass `options` from Xml::fromArray. * - * @param string|array|object $input XML string, a path to a file, a URL or an array - * @param array $options The options to use + * @param object|array|string $input XML string, a path to a file, a URL or an array + * @param array $options The options to use * @return \SimpleXMLElement|\DOMDocument SimpleXMLElement or DOMDocument * @throws \Cake\Utility\Exception\XmlException */ @@ -136,7 +136,7 @@ public static function build($input, array $options = []) * Parse the input data and create either a SimpleXmlElement object or a DOMDocument. * * @param string $input The input to load. - * @param array $options The options to use. See Xml::build() + * @param array $options The options to use. See Xml::build() * @return \SimpleXMLElement|\DOMDocument * @throws \Cake\Utility\Exception\XmlException */ @@ -163,7 +163,7 @@ function ($input, $options, $flags) { * Parse the input html string and create either a SimpleXmlElement object or a DOMDocument. * * @param string $input The input html string to load. - * @param array $options The options to use. See Xml::build() + * @param array $options The options to use. See Xml::build() * @return \SimpleXMLElement|\DOMDocument * @throws \Cake\Utility\Exception\XmlException */ @@ -195,7 +195,7 @@ function ($input, $options, $flags) { * Parse the input data and create either a SimpleXmlElement object or a DOMDocument. * * @param string $input The input to load. - * @param array $options The options to use. See Xml::build() + * @param array $options The options to use. See Xml::build() * @param \Closure $callable Closure that should return SimpleXMLElement or DOMDocument instance. * @return \SimpleXMLElement|\DOMDocument * @throws \Cake\Utility\Exception\XmlException @@ -261,8 +261,8 @@ protected static function load(string $input, array $options, Closure $callable) * * `description` * - * @param array|object $input Array with data or a collection instance. - * @param array $options The options to use. + * @param object|array $input Array with data or a collection instance. + * @param array $options The options to use. * @return \SimpleXMLElement|\DOMDocument SimpleXMLElement or DOMDocument * @throws \Cake\Utility\Exception\XmlException */ @@ -379,7 +379,7 @@ protected static function _fromArray(DOMDocument $dom, $node, &$data, $format): /** * Helper to _fromArray(). It will create children of arrays * - * @param array $data Array with information to create children + * @param array $data Array with information to create children * @return void */ protected static function _createChild(array $data): void @@ -455,7 +455,7 @@ public static function toArray($obj): array * @param \SimpleXMLElement $xml SimpleXMLElement object * @param array $parentData Parent array with data * @param string $ns Namespace of current child - * @param string[] $namespaces List of namespaces in XML + * @param array $namespaces List of namespaces in XML * @return void */ protected static function _toArray(SimpleXMLElement $xml, array &$parentData, string $ns, array $namespaces): void @@ -463,7 +463,10 @@ protected static function _toArray(SimpleXMLElement $xml, array &$parentData, st $data = []; foreach ($namespaces as $namespace) { - /** @psalm-suppress PossiblyNullIterator */ + /** + * @psalm-suppress PossiblyNullIterator + * @var string $key + */ foreach ($xml->attributes($namespace, true) as $key => $value) { if (!empty($namespace)) { $key = $namespace . ':' . $key; @@ -480,7 +483,7 @@ protected static function _toArray(SimpleXMLElement $xml, array &$parentData, st $asString = trim((string)$xml); if (empty($data)) { $data = $asString; - } elseif (strlen($asString) > 0) { + } elseif ($asString !== '') { $data['@'] = $asString; } diff --git a/app/vendor/cakephp/cakephp/src/Validation/RulesProvider.php b/app/vendor/cakephp/cakephp/src/Validation/RulesProvider.php index 843f0325..970b87fd 100644 --- a/app/vendor/cakephp/cakephp/src/Validation/RulesProvider.php +++ b/app/vendor/cakephp/cakephp/src/Validation/RulesProvider.php @@ -29,7 +29,7 @@ class RulesProvider /** * The class/object to proxy. * - * @var string|object + * @var object|string */ protected $_class; @@ -43,9 +43,9 @@ class RulesProvider /** * Constructor, sets the default class to use for calling methods * - * @param string|object $class the default class to proxy + * @param object|string $class the default class to proxy * @throws \ReflectionException - * @psalm-param class-string|object $class + * @psalm-param object|class-string $class */ public function __construct($class = Validation::class) { @@ -63,7 +63,7 @@ public function __construct($class = Validation::class) * * @param string $method the validation method to call * @param array $arguments the list of arguments to pass to the method - * @return bool Whether or not the validation rule passed + * @return bool Whether the validation rule passed */ public function __call(string $method, array $arguments) { diff --git a/app/vendor/cakephp/cakephp/src/Validation/Validation.php b/app/vendor/cakephp/cakephp/src/Validation/Validation.php index f5edb978..d250a53a 100644 --- a/app/vendor/cakephp/cakephp/src/Validation/Validation.php +++ b/app/vendor/cakephp/cakephp/src/Validation/Validation.php @@ -16,7 +16,7 @@ */ namespace Cake\Validation; -use Cake\I18n\Time; +use Cake\I18n\FrozenTime; use Cake\Utility\Text; use Countable; use DateTimeInterface; @@ -97,7 +97,7 @@ class Validation public const COMPARE_LESS_OR_EQUAL = '<='; /** - * @var string[] + * @var array */ protected const COMPARE_STRING = [ self::COMPARE_EQUAL, @@ -116,7 +116,7 @@ class Validation /** * Some complex patterns needed in multiple places * - * @var array + * @var array */ protected static $_pattern = [ 'hostname' => '(?:[_\p{L}0-9][-_\p{L}0-9]*\.)*(?:[\p{L}0-9][-\p{L}0-9]{0,62})\.(?:(?:[a-z]{2}\.)?[a-z]{2,})', @@ -232,7 +232,7 @@ public static function lengthBetween($check, int $min, int $max): bool * Returns true if $check is in the proper credit card format. * * @param mixed $check credit card number to validate - * @param string|string[] $type 'all' may be passed as a string, defaults to fast which checks format of + * @param array|string $type 'all' may be passed as a string, defaults to fast which checks format of * most major credit cards if an array is used only the values of the array are checked. * Example: ['amex', 'bankcard', 'maestro'] * @param bool $deep set to true this will check the Luhn algorithm of the credit card. @@ -395,7 +395,7 @@ public static function comparison($check1, string $operator, $check2): bool * * @param mixed $check The value to find in $field. * @param string $field The field to check $check against. This field must be present in $context. - * @param array $context The validation context. + * @param array $context The validation context. * @return bool */ public static function compareWith($check, string $field, array $context): bool @@ -411,7 +411,7 @@ public static function compareWith($check, string $field, array $context): bool * @param mixed $check The value to find in $field. * @param string $field The field to check $check against. This field must be present in $context. * @param string $operator Comparison operator. See Validation::comparison(). - * @param array $context The validation context. + * @param array $context The validation context. * @return bool * @since 3.6.0 */ @@ -486,8 +486,8 @@ public static function custom($check, ?string $regex = null): bool * - `y` 2006 just the year without any separators * * @param mixed $check a valid date string/object - * @param string|array $format Use a string or an array of the keys above. - * Arrays should be passed as ['dmy', 'mdy', etc] + * @param array|string $format Use a string or an array of the keys above. + * Arrays should be passed as ['dmy', 'mdy', ...] * @param string|null $regex If a custom regular expression is used this is the only validation that will occur. * @return bool Success */ @@ -561,7 +561,7 @@ public static function date($check, $format = 'ymd', ?string $regex = null): boo * All values matching the "date" core validation rule, and the "time" one will be valid * * @param mixed $check Value to check - * @param string|array $dateFormat Format of the date part. See Validation::date() for more information. + * @param array|string $dateFormat Format of the date part. See Validation::date() for more information. * Or `Validation::DATETIME_ISO8601` to validate an ISO8601 datetime value. * @param string|null $regex Regex for the date part. If a custom regular expression is used * this is the only validation that will occur. @@ -687,7 +687,7 @@ public static function localizedTime($check, string $type = 'datetime', $format } $method = $methods[$type]; - return Time::$method($check, $format) !== null; + return FrozenTime::$method($check, $format) !== null; } /** @@ -695,7 +695,7 @@ public static function localizedTime($check, string $type = 'datetime', $format * * The list of what is considered to be boolean values, may be set via $booleanValues. * - * @param bool|int|string $check Value to check. + * @param string|int|bool $check Value to check. * @param array $booleanValues List of valid boolean values, defaults to `[true, false, 0, 1, '0', '1']`. * @return bool Success. */ @@ -713,7 +713,7 @@ public static function boolean($check, array $booleanValues = []): bool * * The list of what is considered to be truthy values, may be set via $truthyValues. * - * @param bool|int|string $check Value to check. + * @param string|int|bool $check Value to check. * @param array $truthyValues List of valid truthy values, defaults to `[true, 1, '1']`. * @return bool Success. */ @@ -731,7 +731,7 @@ public static function truthy($check, array $truthyValues = []): bool * * The list of what is considered to be falsey values, may be set via $falseyValues. * - * @param bool|int|string $check Value to check. + * @param string|int|bool $check Value to check. * @param array $falseyValues List of valid falsey values, defaults to `[false, 0, '0']`. * @return bool Success. */ @@ -857,8 +857,8 @@ public static function equalTo($check, $comparedTo): bool /** * Checks that value has a valid file extension. * - * @param string|array|\Psr\Http\Message\UploadedFileInterface $check Value to check - * @param string[] $extensions file extensions to allow. By default extensions are 'gif', 'jpeg', 'png', 'jpg' + * @param \Psr\Http\Message\UploadedFileInterface|array|string $check Value to check + * @param array $extensions file extensions to allow. By default extensions are 'gif', 'jpeg', 'png', 'jpg' * @return bool Success */ public static function extension($check, array $extensions = ['gif', 'jpeg', 'png', 'jpg']): bool @@ -1003,7 +1003,7 @@ public static function money($check, string $symbolPosition = 'left'): bool * - min => minimum number of non-zero choices that can be made * * @param mixed $check Value to check - * @param array $options Options for the check. + * @param array $options Options for the check. * @param bool $caseInsensitive Set to true for case insensitive comparison. * @return bool Success */ @@ -1142,7 +1142,7 @@ public static function url($check, bool $strict = false): bool * Checks if a value is in a given list. Comparison is case sensitive by default. * * @param mixed $check Value to check. - * @param string[] $list List to check against. + * @param array $list List to check against. * @param bool $caseInsensitive Set to true for case insensitive comparison. * @return bool Success. */ @@ -1221,7 +1221,7 @@ public static function luhn($check): bool * by checking the using finfo on the file, not relying on the content-type * sent by the client. * - * @param string|array|\Psr\Http\Message\UploadedFileInterface $check Value to check. + * @param \Psr\Http\Message\UploadedFileInterface|array|string $check Value to check. * @param array|string $mimeTypes Array of mime types or regex pattern to check. * @return bool Success * @throws \RuntimeException when mime type can not be determined. @@ -1300,9 +1300,9 @@ protected static function getFilename($check) * by checking the filesize() on disk and not relying on the length * reported by the client. * - * @param string|array|\Psr\Http\Message\UploadedFileInterface $check Value to check. + * @param \Psr\Http\Message\UploadedFileInterface|array|string $check Value to check. * @param string $operator See `Validation::comparison()`. - * @param int|string $size Size in bytes or human readable string like '5MB'. + * @param string|int $size Size in bytes or human readable string like '5MB'. * @return bool Success */ public static function fileSize($check, string $operator, $size): bool @@ -1323,7 +1323,7 @@ public static function fileSize($check, string $operator, $size): bool /** * Checking for upload errors * - * @param string|array|\Psr\Http\Message\UploadedFileInterface $check Value to check. + * @param \Psr\Http\Message\UploadedFileInterface|array|string $check Value to check. * @param bool $allowNoFile Set to true to allow UPLOAD_ERR_NO_FILE as a pass. * @return bool * @see https://secure.php.net/manual/en/features.file-upload.errors.php @@ -1357,11 +1357,11 @@ public static function uploadError($check, bool $allowNoFile = false): bool * the file type will be checked with ext/finfo. * - `minSize` - The minimum file size in bytes. Defaults to not checking. * - `maxSize` - The maximum file size in bytes. Defaults to not checking. - * - `optional` - Whether or not this file is optional. Defaults to false. + * - `optional` - Whether this file is optional. Defaults to false. * If true a missing file will pass the validator regardless of other constraints. * * @param mixed $file The uploaded file data from PHP. - * @param array $options An array of options for the validation. + * @param array $options An array of options for the validation. * @return bool */ public static function uploadedFile($file, array $options = []): bool @@ -1419,7 +1419,7 @@ public static function uploadedFile($file, array $options = []): bool * Validates the size of an uploaded image. * * @param mixed $file The uploaded file data from PHP. - * @param array $options Options to validate width and height. + * @param array $options Options to validate width and height. * @return bool * @throws \InvalidArgumentException */ @@ -1509,7 +1509,7 @@ public static function imageHeight($file, string $operator, int $height): bool * only a part of the coordinate. * * @param mixed $value Geographic location as string - * @param array $options Options for the validation logic. + * @param array $options Options for the validation logic. * @return bool */ public static function geoCoordinate($value, array $options = []): bool @@ -1543,7 +1543,7 @@ public static function geoCoordinate($value, array $options = []): bool * Convenience method for latitude validation. * * @param mixed $value Latitude as string - * @param array $options Options for the validation logic. + * @param array $options Options for the validation logic. * @return bool * @link https://en.wikipedia.org/wiki/Latitude * @see \Cake\Validation\Validation::geoCoordinate() @@ -1559,7 +1559,7 @@ public static function latitude($value, array $options = []): bool * Convenience method for longitude validation. * * @param mixed $value Latitude as string - * @param array $options Options for the validation logic. + * @param array $options Options for the validation logic. * @return bool * @link https://en.wikipedia.org/wiki/Longitude * @see \Cake\Validation\Validation::geoCoordinate() @@ -1600,7 +1600,7 @@ public static function ascii($value): bool * the basic multilingual plane. Defaults to false. * * @param mixed $value The value to check - * @param array $options An array of options. See above for the supported options. + * @param array $options An array of options. See above for the supported options. * @return bool */ public static function utf8($value, array $options = []): bool @@ -1716,7 +1716,7 @@ public static function iban($check): bool * The arrays are typically sent for validation from a form generated by * the CakePHP FormHelper. * - * @param array $value The array representing a date or datetime. + * @param array $value The array representing a date or datetime. * @return string */ protected static function _getDateString(array $value): string diff --git a/app/vendor/cakephp/cakephp/src/Validation/ValidationRule.php b/app/vendor/cakephp/cakephp/src/Validation/ValidationRule.php index 087c0fd2..326e7556 100644 --- a/app/vendor/cakephp/cakephp/src/Validation/ValidationRule.php +++ b/app/vendor/cakephp/cakephp/src/Validation/ValidationRule.php @@ -31,14 +31,14 @@ class ValidationRule /** * The method to be called for a given scope * - * @var string|callable + * @var callable|string */ protected $_rule; /** * The 'on' key * - * @var string|callable + * @var callable|string */ protected $_on; @@ -98,15 +98,15 @@ public function isLast(): bool * it is assumed that the rule failed and the error message was given as a result. * * @param mixed $value The data to validate - * @param array $providers associative array with objects or class names that will + * @param array $providers Associative array with objects or class names that will * be passed as the last argument for the validation method - * @param array $context A key value list of data that could be used as context + * @param array $context A key value list of data that could be used as context * during validation. Recognized keys are: - * - newRecord: (boolean) whether or not the data to be validated belongs to a + * - newRecord: (boolean) whether the data to be validated belongs to a * new record * - data: The full data that was passed to the validation process * - field: The name of the field that is being processed - * @return bool|string|array + * @return array|string|bool * @throws \InvalidArgumentException when the supplied rule is not a valid * callable for the configured scope */ @@ -155,9 +155,9 @@ public function process($value, array $providers, array $context = []) /** * Checks if the validation rule should be skipped * - * @param array $context A key value list of data that could be used as context + * @param array $context A key value list of data that could be used as context * during validation. Recognized keys are: - * - newRecord: (boolean) whether or not the data to be validated belongs to a + * - newRecord: (boolean) whether the data to be validated belongs to a * new record * - data: The full data that was passed to the validation process * - providers associative array with objects or class names that will @@ -190,7 +190,7 @@ protected function _skip(array $context): bool protected function _addValidatorProps(array $validator = []): void { foreach ($validator as $key => $value) { - if (!isset($value) || empty($value)) { + if (empty($value)) { continue; } if ($key === 'rule' && is_array($value) && !is_callable($value)) { @@ -212,8 +212,7 @@ protected function _addValidatorProps(array $validator = []): void public function get(string $property) { $property = '_' . $property; - if (isset($this->{$property})) { - return $this->{$property}; - } + + return $this->{$property} ?? null; } } diff --git a/app/vendor/cakephp/cakephp/src/Validation/ValidationSet.php b/app/vendor/cakephp/cakephp/src/Validation/ValidationSet.php index 4ca0a335..a16ab6b6 100644 --- a/app/vendor/cakephp/cakephp/src/Validation/ValidationSet.php +++ b/app/vendor/cakephp/cakephp/src/Validation/ValidationSet.php @@ -31,28 +31,28 @@ class ValidationSet implements ArrayAccess, IteratorAggregate, Countable /** * Holds the ValidationRule objects * - * @var \Cake\Validation\ValidationRule[] + * @var array<\Cake\Validation\ValidationRule> */ protected $_rules = []; /** * Denotes whether the fieldname key must be present in data array * - * @var bool|string|callable + * @var callable|string|bool */ protected $_validatePresent = false; /** * Denotes if a field is allowed to be empty * - * @var bool|string|callable + * @var callable|string|bool */ protected $_allowEmpty = false; /** - * Returns whether or not a field can be left out. + * Returns whether a field can be left out. * - * @return bool|string|callable + * @return callable|string|bool */ public function isPresenceRequired() { @@ -62,7 +62,7 @@ public function isPresenceRequired() /** * Sets whether a field is required to be present in data array. * - * @param bool|string|callable $validatePresent Valid values are true, false, 'create', 'update' or a callable. + * @param callable|string|bool $validatePresent Valid values are true, false, 'create', 'update' or a callable. * @return $this */ public function requirePresence($validatePresent) @@ -73,9 +73,9 @@ public function requirePresence($validatePresent) } /** - * Returns whether or not a field can be left empty. + * Returns whether a field can be left empty. * - * @return bool|string|callable + * @return callable|string|bool */ public function isEmptyAllowed() { @@ -85,7 +85,7 @@ public function isEmptyAllowed() /** * Sets whether a field value is allowed to be empty. * - * @param bool|string|callable $allowEmpty Valid values are true, false, + * @param callable|string|bool $allowEmpty Valid values are true, false, * 'create', 'update' or a callable. * @return $this */ @@ -114,7 +114,7 @@ public function rule(string $name): ?ValidationRule /** * Returns all rules for this validation set * - * @return \Cake\Validation\ValidationRule[] + * @return array<\Cake\Validation\ValidationRule> */ public function rules(): array { @@ -215,8 +215,7 @@ public function offsetUnset($index): void /** * Returns an iterator for each of the rules to be applied * - * @return \Cake\Validation\ValidationRule[] - * @psalm-return \Traversable + * @return \Traversable */ public function getIterator(): Traversable { diff --git a/app/vendor/cakephp/cakephp/src/Validation/Validator.php b/app/vendor/cakephp/cakephp/src/Validation/Validator.php index c08021f5..ef574a78 100644 --- a/app/vendor/cakephp/cakephp/src/Validation/Validator.php +++ b/app/vendor/cakephp/cakephp/src/Validation/Validator.php @@ -130,8 +130,7 @@ class Validator implements ArrayAccess, IteratorAggregate, Countable /** * Holds the ValidationSet objects array * - * @var \Cake\Validation\ValidationSet[] - * @psalm-var array + * @var array */ protected $_fields = []; @@ -139,14 +138,16 @@ class Validator implements ArrayAccess, IteratorAggregate, Countable * An associative array of objects or classes containing methods * used for validation * - * @var array + * @var array + * @psalm-var array */ protected $_providers = []; /** * An associative array of objects or classes used as a default provider list * - * @var array + * @var array + * @psalm-var array */ protected static $_defaultProviders = []; @@ -159,7 +160,7 @@ class Validator implements ArrayAccess, IteratorAggregate, Countable protected $_presenceMessages = []; /** - * Whether or not to use I18n functions for translating default error messages + * Whether to use I18n functions for translating default error messages * * @var bool */ @@ -217,7 +218,7 @@ public function setStopOnFailure(bool $stopOnFailure = true) * * @param array $data The data to be checked for errors * @param bool $newRecord whether the data to be validated is new or to be updated. - * @return array[] Array of failed fields + * @return array Array of failed fields * @deprecated 3.9.0 Renamed to {@link validate()}. */ public function errors(array $data, bool $newRecord = true): array @@ -232,7 +233,7 @@ public function errors(array $data, bool $newRecord = true): array * * @param array $data The data to be checked for errors * @param bool $newRecord whether the data to be validated is new or to be updated. - * @return array[] Array of failed fields + * @return array Array of failed fields */ public function validate(array $data, bool $newRecord = true): array { @@ -299,7 +300,7 @@ public function field(string $name, ?ValidationSet $set = null): ValidationSet } /** - * Check whether or not a validator contains any rules for the given field. + * Check whether a validator contains any rules for the given field. * * @param string $name The field name to check. * @return bool @@ -317,10 +318,18 @@ public function hasField(string $name): bool * * @param string $name The name under which the provider should be set. * @param object|string $object Provider object or class name. + * @psalm-param object|class-string $object * @return $this */ public function setProvider(string $name, $object) { + if (!is_string($object) && !is_object($object)) { + deprecationWarning(sprintf( + 'The provider must be an object or class name string. Got `%s` instead.', + getTypeName($object) + )); + } + $this->_providers[$name] = $object; return $this; @@ -331,6 +340,7 @@ public function setProvider(string $name, $object) * * @param string $name The name under which the provider should be set. * @return object|string|null + * @psalm-return object|class-string|null */ public function getProvider(string $name) { @@ -351,14 +361,11 @@ public function getProvider(string $name) * * @param string $name The name under which the provider should be retrieved. * @return object|string|null + * @psalm-return object|class-string|null */ public static function getDefaultProvider(string $name) { - if (!isset(self::$_defaultProviders[$name])) { - return null; - } - - return self::$_defaultProviders[$name]; + return self::$_defaultProviders[$name] ?? null; } /** @@ -366,17 +373,25 @@ public static function getDefaultProvider(string $name) * * @param string $name The name under which the provider should be set. * @param object|string $object Provider object or class name. + * @psalm-param object|class-string $object * @return void */ public static function addDefaultProvider(string $name, $object): void { + if (!is_string($object) && !is_object($object)) { + deprecationWarning(sprintf( + 'The provider must be an object or class name string. Got `%s` instead.', + getTypeName($object) + )); + } + self::$_defaultProviders[$name] = $object; } /** * Get the list of default providers. * - * @return string[] + * @return array */ public static function getDefaultProviders(): array { @@ -386,7 +401,7 @@ public static function getDefaultProviders(): array /** * Get the list of providers in this validator. * - * @return string[] + * @return array */ public function providers(): array { @@ -419,7 +434,7 @@ public function offsetGet($field): ValidationSet * Sets the rule set for a field * * @param string $field name of the field to set - * @param array|\Cake\Validation\ValidationSet $rules set of rules to apply to field + * @param \Cake\Validation\ValidationSet|array $rules set of rules to apply to field * @return void */ public function offsetSet($field, $rules): void @@ -448,8 +463,7 @@ public function offsetUnset($field): void /** * Returns an iterator for each of the fields to be validated * - * @return \Cake\Validation\ValidationSet[] - * @psalm-return \Traversable + * @return \Traversable */ public function getIterator(): Traversable { @@ -486,7 +500,7 @@ public function count(): int * * @param string $field The name of the field from which the rule will be added * @param array|string $name The alias for a single rule or multiple rules array - * @param array|\Cake\Validation\ValidationRule $rule the rule to add + * @param \Cake\Validation\ValidationRule|array $rule the rule to add * @throws \InvalidArgumentException If numeric index cannot be resolved to a string one * @return $this */ @@ -546,7 +560,7 @@ public function add(string $field, $name, $rule = []) * @param string $field The root field for the nested validator. * @param \Cake\Validation\Validator $validator The nested validator. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @return $this */ @@ -589,7 +603,7 @@ public function addNested(string $field, Validator $validator, ?string $message * @param string $field The root field for the nested validator. * @param \Cake\Validation\Validator $validator The nested validator. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @return $this */ @@ -662,8 +676,8 @@ public function remove(string $field, ?string $rule = null) * You can also set mode and message for all passed fields, the individual * setting takes precedence over group settings. * - * @param string|array $field the name of the field or list of fields. - * @param bool|string|callable $mode Valid values are true, false, 'create', 'update'. + * @param array|string $field the name of the field or list of fields. + * @param callable|string|bool $mode Valid values are true, false, 'create', 'update'. * If a callable is passed then the field will be required only when the callback * returns true. * @param string|null $message The message to show if the field presence validation fails. @@ -754,8 +768,8 @@ public function requirePresence($field, $mode = true, ?string $message = null) * * @deprecated 3.7.0 Use {@link allowEmptyString()}, {@link allowEmptyArray()}, {@link allowEmptyFile()}, * {@link allowEmptyDate()}, {@link allowEmptyTime()}, {@link allowEmptyDateTime()} or {@link allowEmptyFor()} instead. - * @param string|array $field the name of the field or a list of fields - * @param bool|string|callable $when Indicates when the field is allowed to be empty + * @param array|string $field the name of the field or a list of fields + * @param callable|string|bool $when Indicates when the field is allowed to be empty * Valid values are true (always), 'create', 'update'. If a callable is passed then * the field will allowed to be empty only when the callback returns true. * @param string|null $message The message to show if the field is not @@ -853,7 +867,7 @@ public function allowEmpty($field, $when = true, $message = null) * @param string $field The name of the field. * @param int|null $flags A bitmask of EMPTY_* flags which specify what is empty. * If no flags/bitmask is provided only `null` will be allowed as empty value. - * @param bool|string|callable $when Indicates when the field is allowed to be empty + * @param callable|string|bool $when Indicates when the field is allowed to be empty * Valid values are true, false, 'create', 'update'. If a callable is passed then * the field will allowed to be empty only when the callback returns true. * @param string|null $message The message to show if the field is not @@ -880,7 +894,7 @@ public function allowEmptyFor(string $field, ?int $flags = null, $when = true, ? * * @param string $field The name of the field. * @param string|null $message The message to show if the field is not - * @param bool|string|callable $when Indicates when the field is allowed to be empty + * @param callable|string|bool $when Indicates when the field is allowed to be empty * Valid values are true, false, 'create', 'update'. If a callable is passed then * the field will allowed to be empty only when the callback returns true. * @return $this @@ -892,13 +906,13 @@ public function allowEmptyString(string $field, ?string $message = null, $when = } /** - * Requires a field to be not be an empty string. + * Requires a field to not be an empty string. * * Opposite to allowEmptyString() * * @param string $field The name of the field. * @param string|null $message The message to show if the field is empty. - * @param bool|string|callable $when Indicates when the field is not allowed + * @param callable|string|bool $when Indicates when the field is not allowed * to be empty. Valid values are false (never), 'create', 'update'. If a * callable is passed then the field will be required to be not empty when * the callback returns true. @@ -921,7 +935,7 @@ public function notEmptyString(string $field, ?string $message = null, $when = f * * @param string $field The name of the field. * @param string|null $message The message to show if the field is not - * @param bool|string|callable $when Indicates when the field is allowed to be empty + * @param callable|string|bool $when Indicates when the field is allowed to be empty * Valid values are true, false, 'create', 'update'. If a callable is passed then * the field will allowed to be empty only when the callback returns true. * @return $this @@ -940,7 +954,7 @@ public function allowEmptyArray(string $field, ?string $message = null, $when = * * @param string $field The name of the field. * @param string|null $message The message to show if the field is empty. - * @param bool|string|callable $when Indicates when the field is not allowed + * @param callable|string|bool $when Indicates when the field is not allowed * to be empty. Valid values are false (never), 'create', 'update'. If a * callable is passed then the field will be required to be not empty when * the callback returns true. @@ -963,7 +977,7 @@ public function notEmptyArray(string $field, ?string $message = null, $when = fa * * @param string $field The name of the field. * @param string|null $message The message to show if the field is not - * @param bool|string|callable $when Indicates when the field is allowed to be empty + * @param callable|string|bool $when Indicates when the field is allowed to be empty * Valid values are true, 'create', 'update'. If a callable is passed then * the field will allowed to be empty only when the callback returns true. * @return $this @@ -982,7 +996,7 @@ public function allowEmptyFile(string $field, ?string $message = null, $when = t * * @param string $field The name of the field. * @param string|null $message The message to show if the field is empty. - * @param bool|string|callable $when Indicates when the field is not allowed + * @param callable|string|bool $when Indicates when the field is not allowed * to be empty. Valid values are false (never), 'create', 'update'. If a * callable is passed then the field will be required to be not empty when * the callback returns true. @@ -1005,7 +1019,7 @@ public function notEmptyFile(string $field, ?string $message = null, $when = fal * * @param string $field The name of the field. * @param string|null $message The message to show if the field is not - * @param bool|string|callable $when Indicates when the field is allowed to be empty + * @param callable|string|bool $when Indicates when the field is allowed to be empty * Valid values are true, false, 'create', 'update'. If a callable is passed then * the field will allowed to be empty only when the callback returns true. * @return $this @@ -1021,7 +1035,7 @@ public function allowEmptyDate(string $field, ?string $message = null, $when = t * * @param string $field The name of the field. * @param string|null $message The message to show if the field is empty. - * @param bool|string|callable $when Indicates when the field is not allowed + * @param callable|string|bool $when Indicates when the field is not allowed * to be empty. Valid values are false (never), 'create', 'update'. If a * callable is passed then the field will be required to be not empty when * the callback returns true. @@ -1046,7 +1060,7 @@ public function notEmptyDate(string $field, ?string $message = null, $when = fal * * @param string $field The name of the field. * @param string|null $message The message to show if the field is not - * @param bool|string|callable $when Indicates when the field is allowed to be empty + * @param callable|string|bool $when Indicates when the field is allowed to be empty * Valid values are true, false, 'create', 'update'. If a callable is passed then * the field will allowed to be empty only when the callback returns true. * @return $this @@ -1065,7 +1079,7 @@ public function allowEmptyTime(string $field, ?string $message = null, $when = t * * @param string $field The name of the field. * @param string|null $message The message to show if the field is empty. - * @param bool|string|callable $when Indicates when the field is not allowed + * @param callable|string|bool $when Indicates when the field is not allowed * to be empty. Valid values are false (never), 'create', 'update'. If a * callable is passed then the field will be required to be not empty when * the callback returns true. @@ -1091,7 +1105,7 @@ public function notEmptyTime(string $field, ?string $message = null, $when = fal * * @param string $field The name of the field. * @param string|null $message The message to show if the field is not - * @param bool|string|callable $when Indicates when the field is allowed to be empty + * @param callable|string|bool $when Indicates when the field is allowed to be empty * Valid values are true, false, 'create', 'update'. If a callable is passed then * the field will allowed to be empty only when the callback returns false. * @return $this @@ -1110,7 +1124,7 @@ public function allowEmptyDateTime(string $field, ?string $message = null, $when * * @param string $field The name of the field. * @param string|null $message The message to show if the field is empty. - * @param bool|string|callable $when Indicates when the field is not allowed + * @param callable|string|bool $when Indicates when the field is not allowed * to be empty. Valid values are false (never), 'create', 'update'. If a * callable is passed then the field will be required to be not empty when * the callback returns true. @@ -1128,10 +1142,10 @@ public function notEmptyDateTime(string $field, ?string $message = null, $when = /** * Converts validator to fieldName => $settings array * - * @param int|string $fieldName name of field - * @param array $defaults default settings - * @param string|array $settings settings from data - * @return array[] + * @param string|int $fieldName name of field + * @param array $defaults default settings + * @param array|string $settings settings from data + * @return array * @throws \InvalidArgumentException */ protected function _convertValidatorToArray($fieldName, array $defaults = [], $settings = []): array @@ -1210,9 +1224,9 @@ protected function _convertValidatorToArray($fieldName, array $defaults = [], $s * * @deprecated 3.7.0 Use {@link notEmptyString()}, {@link notEmptyArray()}, {@link notEmptyFile()}, * {@link notEmptyDate()}, {@link notEmptyTime()} or {@link notEmptyDateTime()} instead. - * @param string|array $field the name of the field or list of fields + * @param array|string $field the name of the field or list of fields * @param string|null $message The message to show if the field is not - * @param bool|string|callable $when Indicates when the field is not allowed + * @param callable|string|bool $when Indicates when the field is not allowed * to be empty. Valid values are true (always), 'create', 'update'. If a * callable is passed then the field will allowed to be empty only when * the callback returns false. @@ -1254,11 +1268,11 @@ public function notEmpty($field, ?string $message = null, $when = false) /** * Invert a when clause for creating notEmpty rules * - * @param bool|string|callable $when Indicates when the field is not allowed + * @param callable|string|bool $when Indicates when the field is not allowed * to be empty. Valid values are true (always), 'create', 'update'. If a * callable is passed then the field will allowed to be empty only when * the callback returns false. - * @return bool|string|callable + * @return callable|string|bool */ protected function invertWhenClause($when) { @@ -1279,7 +1293,7 @@ protected function invertWhenClause($when) * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::notBlank() * @return $this @@ -1298,7 +1312,7 @@ public function notBlank(string $field, ?string $message = null, $when = null) * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::alphaNumeric() * @return $this @@ -1317,7 +1331,7 @@ public function alphaNumeric(string $field, ?string $message = null, $when = nul * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::notAlphaNumeric() * @return $this @@ -1336,7 +1350,7 @@ public function notAlphaNumeric(string $field, ?string $message = null, $when = * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::asciiAlphaNumeric() * @return $this @@ -1355,7 +1369,7 @@ public function asciiAlphaNumeric(string $field, ?string $message = null, $when * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::notAlphaNumeric() * @return $this @@ -1375,7 +1389,7 @@ public function notAsciiAlphaNumeric(string $field, ?string $message = null, $wh * @param string $field The field you want to apply the rule to. * @param array $range The inclusive minimum and maximum length you want permitted. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::alphaNumeric() * @return $this @@ -1400,7 +1414,7 @@ public function lengthBetween(string $field, array $range, ?string $message = nu * @param string $type The type of cards you want to allow. Defaults to 'all'. * You can also supply an array of accepted card types. e.g `['mastercard', 'visa', 'amex']` * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::creditCard() * @return $this @@ -1418,9 +1432,9 @@ public function creditCard(string $field, string $type = 'all', ?string $message * Add a greater than comparison rule to a field. * * @param string $field The field you want to apply the rule to. - * @param int|float $value The value user data must be greater than. + * @param float|int $value The value user data must be greater than. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::comparison() * @return $this @@ -1438,9 +1452,9 @@ public function greaterThan(string $field, $value, ?string $message = null, $whe * Add a greater than or equal to comparison rule to a field. * * @param string $field The field you want to apply the rule to. - * @param int|float $value The value user data must be greater than or equal to. + * @param float|int $value The value user data must be greater than or equal to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::comparison() * @return $this @@ -1458,9 +1472,9 @@ public function greaterThanOrEqual(string $field, $value, ?string $message = nul * Add a less than comparison rule to a field. * * @param string $field The field you want to apply the rule to. - * @param int|float $value The value user data must be less than. + * @param float|int $value The value user data must be less than. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::comparison() * @return $this @@ -1478,9 +1492,9 @@ public function lessThan(string $field, $value, ?string $message = null, $when = * Add a less than or equal comparison rule to a field. * * @param string $field The field you want to apply the rule to. - * @param int|float $value The value user data must be less than or equal to. + * @param float|int $value The value user data must be less than or equal to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::comparison() * @return $this @@ -1498,9 +1512,9 @@ public function lessThanOrEqual(string $field, $value, ?string $message = null, * Add a equal to comparison rule to a field. * * @param string $field The field you want to apply the rule to. - * @param int|float $value The value user data must be equal to. + * @param float|int $value The value user data must be equal to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::comparison() * @return $this @@ -1518,9 +1532,9 @@ public function equals(string $field, $value, ?string $message = null, $when = n * Add a not equal to comparison rule to a field. * * @param string $field The field you want to apply the rule to. - * @param int|float $value The value user data must be not be equal to. + * @param float|int $value The value user data must be not be equal to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::comparison() * @return $this @@ -1542,7 +1556,7 @@ public function notEquals(string $field, $value, ?string $message = null, $when * @param string $field The field you want to apply the rule to. * @param string $secondField The field you want to compare against. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::compareFields() * @return $this @@ -1562,7 +1576,7 @@ public function sameAs(string $field, string $secondField, ?string $message = nu * @param string $field The field you want to apply the rule to. * @param string $secondField The field you want to compare against. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::compareFields() * @return $this @@ -1583,7 +1597,7 @@ public function notSameAs(string $field, string $secondField, ?string $message = * @param string $field The field you want to apply the rule to. * @param string $secondField The field you want to compare against. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::compareFields() * @return $this @@ -1604,7 +1618,7 @@ public function equalToField(string $field, string $secondField, ?string $messag * @param string $field The field you want to apply the rule to. * @param string $secondField The field you want to compare against. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::compareFields() * @return $this @@ -1625,7 +1639,7 @@ public function notEqualToField(string $field, string $secondField, ?string $mes * @param string $field The field you want to apply the rule to. * @param string $secondField The field you want to compare against. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::compareFields() * @return $this @@ -1646,7 +1660,7 @@ public function greaterThanField(string $field, string $secondField, ?string $me * @param string $field The field you want to apply the rule to. * @param string $secondField The field you want to compare against. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::compareFields() * @return $this @@ -1667,7 +1681,7 @@ public function greaterThanOrEqualToField(string $field, string $secondField, ?s * @param string $field The field you want to apply the rule to. * @param string $secondField The field you want to compare against. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::compareFields() * @return $this @@ -1688,7 +1702,7 @@ public function lessThanField(string $field, string $secondField, ?string $messa * @param string $field The field you want to apply the rule to. * @param string $secondField The field you want to compare against. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::compareFields() * @return $this @@ -1709,7 +1723,7 @@ public function lessThanOrEqualToField(string $field, string $secondField, ?stri * @param string $field The field you want to apply the rule to. * @param int $limit The minimum number of non-alphanumeric fields required. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::containsNonAlphaNumeric() * @return $this @@ -1729,9 +1743,9 @@ public function containsNonAlphaNumeric(string $field, int $limit = 1, ?string $ * Add a date format validation rule to a field. * * @param string $field The field you want to apply the rule to. - * @param array $formats A list of accepted date formats. + * @param array $formats A list of accepted date formats. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::date() * @return $this @@ -1749,9 +1763,9 @@ public function date(string $field, array $formats = ['ymd'], ?string $message = * Add a date time format validation rule to a field. * * @param string $field The field you want to apply the rule to. - * @param array $formats A list of accepted date formats. + * @param array $formats A list of accepted date formats. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::datetime() * @return $this @@ -1770,7 +1784,7 @@ public function dateTime(string $field, array $formats = ['ymd'], ?string $messa * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::time() * @return $this @@ -1790,7 +1804,7 @@ public function time(string $field, ?string $message = null, $when = null) * @param string $field The field you want to apply the rule to. * @param string $type Parser type, one out of 'date', 'time', and 'datetime' * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::localizedTime() * @return $this @@ -1809,7 +1823,7 @@ public function localizedTime(string $field, string $type = 'datetime', ?string * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::boolean() * @return $this @@ -1829,7 +1843,7 @@ public function boolean(string $field, ?string $message = null, $when = null) * @param string $field The field you want to apply the rule to. * @param int|null $places The number of decimal places to require. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::decimal() * @return $this @@ -1847,9 +1861,9 @@ public function decimal(string $field, ?int $places = null, ?string $message = n * Add an email validation rule to a field. * * @param string $field The field you want to apply the rule to. - * @param bool $checkMX Whether or not to check the MX records. + * @param bool $checkMX Whether to check the MX records. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::email() * @return $this @@ -1870,7 +1884,7 @@ public function email(string $field, bool $checkMX = false, ?string $message = n * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::ip() * @return $this @@ -1889,7 +1903,7 @@ public function ip(string $field, ?string $message = null, $when = null) * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::ip() * @return $this @@ -1908,7 +1922,7 @@ public function ipv4(string $field, ?string $message = null, $when = null) * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::ip() * @return $this @@ -1928,7 +1942,7 @@ public function ipv6(string $field, ?string $message = null, $when = null) * @param string $field The field you want to apply the rule to. * @param int $min The minimum length required. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::minLength() * @return $this @@ -1948,7 +1962,7 @@ public function minLength(string $field, int $min, ?string $message = null, $whe * @param string $field The field you want to apply the rule to. * @param int $min The minimum length required. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::minLengthBytes() * @return $this @@ -1968,7 +1982,7 @@ public function minLengthBytes(string $field, int $min, ?string $message = null, * @param string $field The field you want to apply the rule to. * @param int $max The maximum length allowed. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::maxLength() * @return $this @@ -1988,7 +2002,7 @@ public function maxLength(string $field, int $max, ?string $message = null, $whe * @param string $field The field you want to apply the rule to. * @param int $max The maximum length allowed. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::maxLengthBytes() * @return $this @@ -2007,7 +2021,7 @@ public function maxLengthBytes(string $field, int $max, ?string $message = null, * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::numeric() * @return $this @@ -2026,7 +2040,7 @@ public function numeric(string $field, ?string $message = null, $when = null) * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::naturalNumber() * @return $this @@ -2045,7 +2059,7 @@ public function naturalNumber(string $field, ?string $message = null, $when = nu * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::naturalNumber() * @return $this @@ -2065,7 +2079,7 @@ public function nonNegativeInteger(string $field, ?string $message = null, $when * @param string $field The field you want to apply the rule to. * @param array $range The inclusive upper and lower bounds of the valid range. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::range() * @return $this @@ -2090,7 +2104,7 @@ public function range(string $field, array $range, ?string $message = null, $whe * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::url() * @return $this @@ -2111,7 +2125,7 @@ public function url(string $field, ?string $message = null, $when = null) * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::url() * @return $this @@ -2131,7 +2145,7 @@ public function urlWithProtocol(string $field, ?string $message = null, $when = * @param string $field The field you want to apply the rule to. * @param array $list The list of valid options. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::inList() * @return $this @@ -2150,7 +2164,7 @@ public function inList(string $field, array $list, ?string $message = null, $whe * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::uuid() * @return $this @@ -2167,14 +2181,12 @@ public function uuid(string $field, ?string $message = null, $when = null) /** * Add a validation rule to ensure the field is an uploaded file * - * For options see Cake\Validation\Validation::uploadedFile() - * * @param string $field The field you want to apply the rule to. - * @param array $options An array of options. + * @param array $options An array of options. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. - * @see \Cake\Validation\Validation::uploadedFile() + * @see \Cake\Validation\Validation::uploadedFile() For options * @return $this */ public function uploadedFile(string $field, array $options, ?string $message = null, $when = null) @@ -2193,7 +2205,7 @@ public function uploadedFile(string $field, array $options, ?string $message = n * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::uuid() * @return $this @@ -2212,7 +2224,7 @@ public function latLong(string $field, ?string $message = null, $when = null) * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::latitude() * @return $this @@ -2231,7 +2243,7 @@ public function latitude(string $field, ?string $message = null, $when = null) * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::longitude() * @return $this @@ -2250,7 +2262,7 @@ public function longitude(string $field, ?string $message = null, $when = null) * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::ascii() * @return $this @@ -2269,7 +2281,7 @@ public function ascii(string $field, ?string $message = null, $when = null) * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::utf8() * @return $this @@ -2290,7 +2302,7 @@ public function utf8(string $field, ?string $message = null, $when = null) * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::utf8() * @return $this @@ -2309,7 +2321,7 @@ public function utf8Extended(string $field, ?string $message = null, $when = nul * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::isInteger() * @return $this @@ -2328,7 +2340,7 @@ public function integer(string $field, ?string $message = null, $when = null) * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::isArray() * @return $this @@ -2347,7 +2359,7 @@ public function isArray(string $field, ?string $message = null, $when = null) * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::isScalar() * @return $this @@ -2366,7 +2378,7 @@ public function scalar(string $field, ?string $message = null, $when = null) * * @param string $field The field you want to apply the rule to. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::hexColor() * @return $this @@ -2384,10 +2396,10 @@ public function hexColor(string $field, ?string $message = null, $when = null) * Add a validation rule for a multiple select. Comparison is case sensitive by default. * * @param string $field The field you want to apply the rule to. - * @param array $options The options for the validator. Includes the options defined in + * @param array $options The options for the validator. Includes the options defined in * \Cake\Validation\Validation::multiple() and the `caseInsensitive` parameter. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::multiple() * @return $this @@ -2410,7 +2422,7 @@ public function multipleOptions(string $field, array $options = [], ?string $mes * @param string $field The field you want to apply the rule to. * @param int $count The number of elements the array should at least have * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::numElements() * @return $this @@ -2437,7 +2449,7 @@ public function hasAtLeast(string $field, int $count, ?string $message = null, $ * @param string $field The field you want to apply the rule to. * @param int $count The number maximum amount of elements the field should have * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @see \Cake\Validation\Validation::numElements() * @return $this @@ -2458,7 +2470,7 @@ public function hasAtMost(string $field, int $count, ?string $message = null, $w } /** - * Returns whether or not a field can be left empty for a new or already existing + * Returns whether a field can be left empty for a new or already existing * record. * * @param string $field Field name. @@ -2475,7 +2487,7 @@ public function isEmptyAllowed(string $field, bool $newRecord): bool } /** - * Returns whether or not a field can be left out for a new or already existing + * Returns whether a field can be left out for a new or already existing * record. * * @param string $field Field name. @@ -2492,12 +2504,12 @@ public function isPresenceRequired(string $field, bool $newRecord): bool } /** - * Returns whether or not a field matches against a regular expression. + * Returns whether a field matches against a regular expression. * * @param string $field Field name. * @param string $regex Regular expression. * @param string|null $message The error message when the rule fails. - * @param string|callable|null $when Either 'create' or 'update' or a callable that returns + * @param callable|string|null $when Either 'create' or 'update' or a callable that returns * true when the validation rule should be applied. * @return $this */ @@ -2561,7 +2573,7 @@ public function getNotEmptyMessage(string $field): ?string * due to the field missing in the data array * * @param \Cake\Validation\ValidationSet $field The set of rules for a field. - * @param array $context A key value list of data containing the validation context. + * @param array $context A key value list of data containing the validation context. * @return bool */ protected function _checkPresence(ValidationSet $field, array $context): bool @@ -2585,7 +2597,7 @@ protected function _checkPresence(ValidationSet $field, array $context): bool * Returns whether the field can be left blank according to `allowEmpty` * * @param \Cake\Validation\ValidationSet $field the set of rules for a field - * @param array $context a key value list of data containing the validation context. + * @param array $context a key value list of data containing the validation context. * @return bool */ protected function _canBeEmpty(ValidationSet $field, array $context): bool @@ -2686,7 +2698,7 @@ protected function isEmpty($data, int $flags): bool * @param \Cake\Validation\ValidationSet $rules the list of rules for a field * @param array $data the full data passed to the validator * @param bool $newRecord whether is it a new record or an existing one - * @return array + * @return array */ protected function _processRules(string $field, ValidationSet $rules, array $data, bool $newRecord): array { @@ -2699,6 +2711,9 @@ protected function _processRules(string $field, ValidationSet $rules, array $dat $message = __d('cake', 'The provided value is invalid'); } + /** + * @var \Cake\Validation\ValidationRule $rule + */ foreach ($rules as $name => $rule) { $result = $rule->process($data[$field], $this->_providers, compact('newRecord', 'data', 'field')); if ($result === true) { @@ -2724,7 +2739,7 @@ protected function _processRules(string $field, ValidationSet $rules, array $dat /** * Get the printable version of this object. * - * @return array + * @return array */ public function __debugInfo(): array { diff --git a/app/vendor/cakephp/cakephp/src/Validation/ValidatorAwareInterface.php b/app/vendor/cakephp/cakephp/src/Validation/ValidatorAwareInterface.php index 7d2d52df..9b71ef26 100644 --- a/app/vendor/cakephp/cakephp/src/Validation/ValidatorAwareInterface.php +++ b/app/vendor/cakephp/cakephp/src/Validation/ValidatorAwareInterface.php @@ -43,7 +43,7 @@ public function getValidator(?string $name = null): Validator; public function setValidator(string $name, Validator $validator); /** - * Checks whether or not a validator has been set. + * Checks whether a validator has been set. * * @param string $name The name of a validator. * @return bool diff --git a/app/vendor/cakephp/cakephp/src/Validation/ValidatorAwareTrait.php b/app/vendor/cakephp/cakephp/src/Validation/ValidatorAwareTrait.php index 5d1c68c6..610ffcc8 100644 --- a/app/vendor/cakephp/cakephp/src/Validation/ValidatorAwareTrait.php +++ b/app/vendor/cakephp/cakephp/src/Validation/ValidatorAwareTrait.php @@ -50,7 +50,7 @@ trait ValidatorAwareTrait /** * A list of validation objects indexed by name * - * @var \Cake\Validation\Validator[] + * @var array<\Cake\Validation\Validator> */ protected $_validators = []; @@ -165,7 +165,7 @@ public function setValidator(string $name, Validator $validator) } /** - * Checks whether or not a validator has been set. + * Checks whether a validator has been set. * * @param string $name The name of a validator. * @return bool diff --git a/app/vendor/cakephp/cakephp/src/View/AjaxView.php b/app/vendor/cakephp/cakephp/src/View/AjaxView.php index f0fa4ae4..064f31fa 100644 --- a/app/vendor/cakephp/cakephp/src/View/AjaxView.php +++ b/app/vendor/cakephp/cakephp/src/View/AjaxView.php @@ -18,7 +18,7 @@ /** * A view class that is used for AJAX responses. - * Currently only switches the default layout and sets the response type - which just maps to + * Currently, only switches the default layout and sets the response type - which just maps to * text/html by default. */ class AjaxView extends View diff --git a/app/vendor/cakephp/cakephp/src/View/Cell.php b/app/vendor/cakephp/cakephp/src/View/Cell.php index 774854c0..00ac8e65 100644 --- a/app/vendor/cakephp/cakephp/src/View/Cell.php +++ b/app/vendor/cakephp/cakephp/src/View/Cell.php @@ -93,7 +93,7 @@ abstract class Cell implements EventDispatcherInterface * Override this property in subclasses to allow * which options you want set as properties in your Cell. * - * @var array + * @var array */ protected $_validCellOptions = []; @@ -109,8 +109,8 @@ abstract class Cell implements EventDispatcherInterface * * @param \Cake\Http\ServerRequest $request The request to use in the cell. * @param \Cake\Http\Response $response The response to use in the cell. - * @param \Cake\Event\EventManagerInterface $eventManager The eventManager to bind events to. - * @param array $cellOptions Cell options to apply. + * @param \Cake\Event\EventManagerInterface|null $eventManager The eventManager to bind events to. + * @param array $cellOptions Cell options to apply. */ public function __construct( ServerRequest $request, @@ -158,6 +158,7 @@ public function initialize(): void * @return string The rendered cell. * @throws \Cake\View\Exception\MissingCellTemplateException * When a MissingTemplateException is raised during rendering. + * @throws \BadMethodCallException */ public function render(?string $template = null): string { @@ -284,7 +285,7 @@ public function __toString(): string /** * Debug info. * - * @return array + * @return array */ public function __debugInfo(): array { diff --git a/app/vendor/cakephp/cakephp/src/View/CellTrait.php b/app/vendor/cakephp/cakephp/src/View/CellTrait.php index 16d465d5..c1a1c810 100644 --- a/app/vendor/cakephp/cakephp/src/View/CellTrait.php +++ b/app/vendor/cakephp/cakephp/src/View/CellTrait.php @@ -51,10 +51,9 @@ trait CellTrait * invoke `View\Cell\TagCloudCell::smallList()`, `display` action will be invoked by default when none is provided. * @param array $data Additional arguments for cell method. e.g.: * `cell('TagCloud::smallList', ['a1' => 'v1', 'a2' => 'v2'])` maps to `View\Cell\TagCloud::smallList(v1, v2)` - * @param array $options Options for Cell's constructor + * @param array $options Options for Cell's constructor * @return \Cake\View\Cell The cell instance * @throws \Cake\View\Exception\MissingCellException If Cell class was not found. - * @throws \BadMethodCallException If Cell class does not specified cell action. */ protected function cell(string $cell, array $data = [], array $options = []): Cell { @@ -88,7 +87,7 @@ protected function cell(string $cell, array $data = [], array $options = []): Ce * @param string $className The cell classname. * @param string $action The action name. * @param string|null $plugin The plugin name. - * @param array $options The constructor options for the cell. + * @param array $options The constructor options for the cell. * @return \Cake\View\Cell */ protected function _createCell(string $className, string $action, ?string $plugin, array $options): Cell @@ -103,7 +102,7 @@ protected function _createCell(string $className, string $action, ?string $plugi $builder->setPlugin($plugin); } if (!empty($this->helpers)) { - $builder->setHelpers($this->helpers); + $builder->addHelpers($this->helpers); } if ($this instanceof View) { diff --git a/app/vendor/cakephp/cakephp/src/View/Exception/MissingCellTemplateException.php b/app/vendor/cakephp/cakephp/src/View/Exception/MissingCellTemplateException.php index e4f80ef6..9a9a5437 100644 --- a/app/vendor/cakephp/cakephp/src/View/Exception/MissingCellTemplateException.php +++ b/app/vendor/cakephp/cakephp/src/View/Exception/MissingCellTemplateException.php @@ -36,7 +36,7 @@ class MissingCellTemplateException extends MissingTemplateException * * @param string $name The Cell name that is missing a view. * @param string $file The view filename. - * @param string[] $paths The path list that template could not be found in. + * @param array $paths The path list that template could not be found in. * @param int|null $code The code of the error. * @param \Throwable|null $previous the previous exception. */ diff --git a/app/vendor/cakephp/cakephp/src/View/Exception/MissingTemplateException.php b/app/vendor/cakephp/cakephp/src/View/Exception/MissingTemplateException.php index d5fcfff8..2cd422e0 100644 --- a/app/vendor/cakephp/cakephp/src/View/Exception/MissingTemplateException.php +++ b/app/vendor/cakephp/cakephp/src/View/Exception/MissingTemplateException.php @@ -30,10 +30,10 @@ class MissingTemplateException extends CakeException /** * @var string */ - protected $file; + protected $filename; /** - * @var string[] + * @var array */ protected $paths; @@ -45,18 +45,18 @@ class MissingTemplateException extends CakeException /** * Constructor * - * @param string|array $file Either the file name as a string, or in an array for backwards compatibility. - * @param string[] $paths The path list that template could not be found in. + * @param array|string $file Either the file name as a string, or in an array for backwards compatibility. + * @param array $paths The path list that template could not be found in. * @param int|null $code The code of the error. * @param \Throwable|null $previous the previous exception. */ public function __construct($file, array $paths = [], ?int $code = null, ?Throwable $previous = null) { if (is_array($file)) { - $this->file = array_pop($file); + $this->filename = array_pop($file); $this->templateName = array_pop($file); } else { - $this->file = $file; + $this->filename = $file; $this->templateName = null; } $this->paths = $paths; @@ -71,12 +71,12 @@ public function __construct($file, array $paths = [], ?int $code = null, ?Throwa */ public function formatMessage(): string { - $name = $this->templateName ?? $this->file; + $name = $this->templateName ?? $this->filename; $message = "{$this->type} file `{$name}` could not be found."; if ($this->paths) { $message .= "\n\nThe following paths were searched:\n\n"; foreach ($this->paths as $path) { - $message .= "- `{$path}{$this->file}`\n"; + $message .= "- `{$path}{$this->filename}`\n"; } } @@ -92,7 +92,7 @@ public function formatMessage(): string public function getAttributes(): array { return [ - 'file' => $this->file, + 'file' => $this->filename, 'paths' => $this->paths, ]; } diff --git a/app/vendor/cakephp/cakephp/src/View/Form/ArrayContext.php b/app/vendor/cakephp/cakephp/src/View/Form/ArrayContext.php index 90a40072..5abddef3 100644 --- a/app/vendor/cakephp/cakephp/src/View/Form/ArrayContext.php +++ b/app/vendor/cakephp/cakephp/src/View/Form/ArrayContext.php @@ -97,7 +97,7 @@ public function __construct(array $context) /** * Get the fields used in the context as a primary key. * - * @return string[] + * @return array * @deprecated 4.0.0 Renamed to {@link getPrimaryKey()}. */ public function primaryKey(): array @@ -110,7 +110,7 @@ public function primaryKey(): array /** * Get the fields used in the context as a primary key. * - * @return string[] + * @return array */ public function getPrimaryKey(): array { @@ -140,7 +140,7 @@ public function isPrimaryKey(string $field): bool } /** - * Returns whether or not this form is for a create operation. + * Returns whether this form is for a create operation. * * For this method to return true, both the primary key constraint * must be defined in the 'schema' data, and the 'defaults' data must @@ -167,7 +167,7 @@ public function isCreate(): bool * * @param string $field A dot separated path to the field a value * is needed for. - * @param array $options Options: + * @param array $options Options: * * - `default`: Default value to return if no value found in data or * context record. @@ -324,7 +324,7 @@ public function attributes(string $field): array } /** - * Check whether or not a field has an error attached to it + * Check whether a field has an error attached to it * * @param string $field A dot separated path to check errors on. * @return bool Returns true if the errors for the field are not empty. diff --git a/app/vendor/cakephp/cakephp/src/View/Form/ContextFactory.php b/app/vendor/cakephp/cakephp/src/View/Form/ContextFactory.php index 490f2aee..d24fa3de 100644 --- a/app/vendor/cakephp/cakephp/src/View/Form/ContextFactory.php +++ b/app/vendor/cakephp/cakephp/src/View/Form/ContextFactory.php @@ -30,7 +30,7 @@ class ContextFactory /** * Context providers. * - * @var array + * @var array */ protected $providers = []; @@ -134,7 +134,7 @@ public function addProvider(string $type, callable $check) * If no type can be matched a NullContext will be returned. * * @param \Cake\Http\ServerRequest $request Request instance. - * @param array $data The data to get a context provider for. + * @param array $data The data to get a context provider for. * @return \Cake\View\Form\ContextInterface Context provider. * @throws \RuntimeException When a context instance cannot be generated for given entity. */ diff --git a/app/vendor/cakephp/cakephp/src/View/Form/ContextInterface.php b/app/vendor/cakephp/cakephp/src/View/Form/ContextInterface.php index 0984c9d3..db22e26c 100644 --- a/app/vendor/cakephp/cakephp/src/View/Form/ContextInterface.php +++ b/app/vendor/cakephp/cakephp/src/View/Form/ContextInterface.php @@ -22,14 +22,14 @@ interface ContextInterface { /** - * @var string[] + * @var array */ public const VALID_ATTRIBUTES = ['length', 'precision', 'comment', 'null', 'default']; /** * Get the fields used in the context as a primary key. * - * @return string[] + * @return array */ public function getPrimaryKey(): array; @@ -43,7 +43,7 @@ public function getPrimaryKey(): array; public function isPrimaryKey(string $field): bool; /** - * Returns whether or not this form is for a create operation. + * Returns whether this form is for a create operation. * * @return bool */ @@ -61,7 +61,7 @@ public function isCreate(): bool; * context's schema should be used if it's not explicitly provided. * * @param string $field A dot separated path to the field a value - * @param array $options Options. + * @param array $options Options. * is needed for. * @return mixed */ @@ -96,7 +96,7 @@ public function getMaxLength(string $field): ?int; /** * Get the field names of the top level object in this context. * - * @return string[] A list of the field names in the context. + * @return array A list of the field names in the context. */ public function fieldNames(): array; @@ -118,7 +118,7 @@ public function type(string $field): ?string; public function attributes(string $field): array; /** - * Check whether or not a field has an error attached to it + * Check whether a field has an error attached to it * * @param string $field A dot separated path to check errors on. * @return bool Returns true if the errors for the field are not empty. diff --git a/app/vendor/cakephp/cakephp/src/View/Form/EntityContext.php b/app/vendor/cakephp/cakephp/src/View/Form/EntityContext.php index 4184c2d8..30d7a679 100644 --- a/app/vendor/cakephp/cakephp/src/View/Form/EntityContext.php +++ b/app/vendor/cakephp/cakephp/src/View/Form/EntityContext.php @@ -67,7 +67,7 @@ class EntityContext implements ContextInterface protected $_rootName; /** - * Boolean to track whether or not the entity is a + * Boolean to track whether the entity is a * collection. * * @var bool @@ -77,14 +77,14 @@ class EntityContext implements ContextInterface /** * A dictionary of tables * - * @var \Cake\ORM\Table[] + * @var array<\Cake\ORM\Table> */ protected $_tables = []; /** * Dictionary of validators. * - * @var \Cake\Validation\Validator[] + * @var array<\Cake\Validation\Validator> */ protected $_validator = []; @@ -123,10 +123,14 @@ protected function _prepare(): void { /** @var \Cake\ORM\Table|null $table */ $table = $this->_context['table']; - /** @var \Cake\Datasource\EntityInterface|iterable $entity */ + /** @var \Cake\Datasource\EntityInterface|iterable<\Cake\Datasource\EntityInterface|array> $entity */ $entity = $this->_context['entity']; + + $this->_isCollection = is_iterable($entity); + if (empty($table)) { - if (is_iterable($entity)) { + if ($this->_isCollection) { + /** @var iterable<\Cake\Datasource\EntityInterface|array> $entity */ foreach ($entity as $e) { $entity = $e; break; @@ -138,12 +142,13 @@ protected function _prepare(): void /** @psalm-suppress PossiblyInvalidMethodCall */ $table = $entity->getSource(); } + /** @psalm-suppress PossiblyInvalidArgument */ if (!$table && $isEntity && get_class($entity) !== Entity::class) { [, $entityClass] = namespaceSplit(get_class($entity)); $table = Inflector::pluralize($entityClass); } } - if (is_string($table) && strlen($table)) { + if (is_string($table) && $table !== '') { $table = $this->getTableLocator()->get($table); } @@ -152,10 +157,6 @@ protected function _prepare(): void 'Unable to find table class for current entity.' ); } - $this->_isCollection = ( - is_array($entity) || - $entity instanceof Traversable - ); $alias = $this->_rootName = $table->getAlias(); $this->_tables[$alias] = $table; @@ -166,7 +167,7 @@ protected function _prepare(): void * * Gets the primary key columns from the root entity's schema. * - * @return string[] + * @return array * @deprecated 4.0.0 Renamed to {@link getPrimaryKey()}. */ public function primaryKey(): array @@ -181,7 +182,7 @@ public function primaryKey(): array * * Gets the primary key columns from the root entity's schema. * - * @return string[] + * @return array */ public function getPrimaryKey(): array { @@ -204,7 +205,7 @@ public function isPrimaryKey(string $field): bool } /** - * Check whether or not this form is a create or update. + * Check whether this form is a create or update. * * If the context is for a single entity, the entity's isNew() method will * be used. If isNew() returns null, a create operation will be assumed. @@ -236,7 +237,7 @@ public function isCreate(): bool * Traverses the entity data and finds the value for $path. * * @param string $field The dot separated path to the value. - * @param array $options Options: + * @param array $options Options: * * - `default`: Default value to return if no value found in data or * entity. @@ -297,7 +298,7 @@ public function val(string $field, array $options = []) /** * Get default value from table schema for given entity field. * - * @param string[] $parts Each one of the parts in a path for a field name + * @param array $parts Each one of the parts in a path for a field name * @return mixed */ protected function _schemaDefault(array $parts) @@ -320,7 +321,7 @@ protected function _schemaDefault(array $parts) * primary key column is guessed out of the provided $path array * * @param mixed $values The list from which to extract primary keys from - * @param string[] $path Each one of the parts in a path for a field name + * @param array $path Each one of the parts in a path for a field name * @return array|null */ protected function _extractMultiple($values, array $path): ?array @@ -485,6 +486,8 @@ protected function _getProp($target, $field) return false; } + + return null; } /** @@ -569,7 +572,7 @@ public function getMaxLength(string $field): ?int * * If the context is for an array of entities, the 0th index will be used. * - * @return string[] Array of field names in the table/entity. + * @return array Array of field names in the table/entity. */ public function fieldNames(): array { @@ -598,8 +601,9 @@ protected function _getValidator(array $parts): Validator $entity = $this->entity($parts) ?: null; if (isset($this->_validator[$key])) { - /** @psalm-suppress PossiblyInvalidArgument */ - $this->_validator[$key]->setProvider('entity', $entity); + if (is_object($entity)) { + $this->_validator[$key]->setProvider('entity', $entity); + } return $this->_validator[$key]; } @@ -618,8 +622,10 @@ protected function _getValidator(array $parts): Validator } $validator = $table->getValidator($method); - /** @psalm-suppress PossiblyInvalidArgument */ - $validator->setProvider('entity', $entity); + + if (is_object($entity)) { + $validator->setProvider('entity', $entity); + } return $this->_validator[$key] = $validator; } @@ -627,8 +633,8 @@ protected function _getValidator(array $parts): Validator /** * Get the table instance from a property path * - * @param string[]|string|\Cake\Datasource\EntityInterface $parts Each one of the parts in a path for a field name - * @param bool $fallback Whether or not to fallback to the last found table + * @param \Cake\Datasource\EntityInterface|array|string $parts Each one of the parts in a path for a field name + * @param bool $fallback Whether to fallback to the last found table * when a nonexistent field/property is being encountered. * @return \Cake\ORM\Table|null Table instance or null */ @@ -718,7 +724,7 @@ public function attributes(string $field): array } /** - * Check whether or not a field has an error attached to it + * Check whether a field has an error attached to it * * @param string $field A dot separated path to check errors on. * @return bool Returns true if the errors for the field are not empty. diff --git a/app/vendor/cakephp/cakephp/src/View/Form/FormContext.php b/app/vendor/cakephp/cakephp/src/View/Form/FormContext.php index f0475ec6..32c9ffda 100644 --- a/app/vendor/cakephp/cakephp/src/View/Form/FormContext.php +++ b/app/vendor/cakephp/cakephp/src/View/Form/FormContext.php @@ -19,7 +19,7 @@ use Cake\Utility\Hash; /** - * Provides a context provider for Cake\Form\Form instances. + * Provides a context provider for {@link \Cake\Form\Form} instances. * * This context provider simply fulfils the interface requirements * that FormHelper has and allows access to the form data. @@ -49,7 +49,7 @@ public function __construct(array $context) /** * Get the fields used in the context as a primary key. * - * @return string[] + * @return array * @deprecated 4.0.0 Renamed to {@link getPrimaryKey()}. */ public function primaryKey(): array diff --git a/app/vendor/cakephp/cakephp/src/View/Form/NullContext.php b/app/vendor/cakephp/cakephp/src/View/Form/NullContext.php index 5a007468..5adf5639 100644 --- a/app/vendor/cakephp/cakephp/src/View/Form/NullContext.php +++ b/app/vendor/cakephp/cakephp/src/View/Form/NullContext.php @@ -36,7 +36,7 @@ public function __construct(array $context) /** * Get the fields used in the context as a primary key. * - * @return string[] + * @return array * @deprecated 4.0.0 Renamed to {@link getPrimaryKey()}. */ public function primaryKey(): array diff --git a/app/vendor/cakephp/cakephp/src/View/Helper.php b/app/vendor/cakephp/cakephp/src/View/Helper.php index 73b71cdc..69530b02 100644 --- a/app/vendor/cakephp/cakephp/src/View/Helper.php +++ b/app/vendor/cakephp/cakephp/src/View/Helper.php @@ -54,14 +54,14 @@ class Helper implements EventListenerInterface /** * Default config for this helper. * - * @var array + * @var array */ protected $_defaultConfig = []; /** * A helper lookup table used to lazy load helper objects. * - * @var array + * @var array */ protected $_helperMap = []; @@ -76,7 +76,7 @@ class Helper implements EventListenerInterface * Default Constructor * * @param \Cake\View\View $view The View this helper is being attached to. - * @param array $config Configuration settings for the helper. + * @param array $config Configuration settings for the helper. */ public function __construct(View $view, array $config = []) { @@ -143,10 +143,10 @@ protected function _confirm(string $okCode, string $cancelCode): string /** * Adds the given class to the element options * - * @param array $options Array options/attributes to add a class to + * @param array $options Array options/attributes to add a class to * @param string $class The class name being added. * @param string $key the key to use for class. Defaults to `'class'`. - * @return array Array of options with $key set. + * @return array Array of options with $key set. */ public function addClass(array $options, string $class, string $key = 'class'): array { @@ -170,7 +170,7 @@ public function addClass(array $options, string $class, string $key = 'class'): * Override this method if you need to add non-conventional event listeners. * Or if you want helpers to listen to non-standard events. * - * @return array + * @return array */ public function implementedEvents(): array { @@ -197,7 +197,7 @@ public function implementedEvents(): array * * Implement this method to avoid having to overwrite the constructor and call parent. * - * @param array $config The configuration settings provided to this helper. + * @param array $config The configuration settings provided to this helper. * @return void */ public function initialize(array $config): void @@ -208,7 +208,7 @@ public function initialize(array $config): void * Returns an array that can be used to describe the internal state of this * object. * - * @return array + * @return array */ public function __debugInfo(): array { diff --git a/app/vendor/cakephp/cakephp/src/View/Helper/BreadcrumbsHelper.php b/app/vendor/cakephp/cakephp/src/View/Helper/BreadcrumbsHelper.php index 11887ead..d96a70a2 100644 --- a/app/vendor/cakephp/cakephp/src/View/Helper/BreadcrumbsHelper.php +++ b/app/vendor/cakephp/cakephp/src/View/Helper/BreadcrumbsHelper.php @@ -39,7 +39,7 @@ class BreadcrumbsHelper extends Helper /** * Default config for the helper. * - * @var array + * @var array */ protected $_defaultConfig = [ 'templates' => [ @@ -60,7 +60,7 @@ class BreadcrumbsHelper extends Helper /** * Add a crumb to the end of the trail. * - * @param string|array $title If provided as a string, it represents the title of the crumb. + * @param array|string $title If provided as a string, it represents the title of the crumb. * Alternatively, if you want to add multiple crumbs at once, you can provide an array, with each values being a * single crumb. Arrays are expected to be of this form: * @@ -68,9 +68,9 @@ class BreadcrumbsHelper extends Helper * - *link* The link of the crumb. If not provided, no link will be made * - *options* Options of the crumb. See description of params option of this method. * - * @param string|array|null $url URL of the crumb. Either a string, an array of route params to pass to + * @param array|string|null $url URL of the crumb. Either a string, an array of route params to pass to * Url::build() or null / empty if the crumb does not have a link. - * @param array $options Array of options. These options will be used as attributes HTML attribute the crumb will + * @param array $options Array of options. These options will be used as attributes HTML attribute the crumb will * be rendered in (a
  • tag by default). It accepts two special keys: * * - *innerAttrs*: An array that allows you to define attributes for the inner element of the crumb (by default, to @@ -96,7 +96,7 @@ public function add($title, $url = null, array $options = []) /** * Prepend a crumb to the start of the queue. * - * @param string|array $title If provided as a string, it represents the title of the crumb. + * @param array|string $title If provided as a string, it represents the title of the crumb. * Alternatively, if you want to add multiple crumbs at once, you can provide an array, with each values being a * single crumb. Arrays are expected to be of this form: * @@ -104,9 +104,9 @@ public function add($title, $url = null, array $options = []) * - *link* The link of the crumb. If not provided, no link will be made * - *options* Options of the crumb. See description of params option of this method. * - * @param string|array|null $url URL of the crumb. Either a string, an array of route params to pass to + * @param array|string|null $url URL of the crumb. Either a string, an array of route params to pass to * Url::build() or null / empty if the crumb does not have a link. - * @param array $options Array of options. These options will be used as attributes HTML attribute the crumb will + * @param array $options Array of options. These options will be used as attributes HTML attribute the crumb will * be rendered in (a
  • tag by default). It accepts two special keys: * * - *innerAttrs*: An array that allows you to define attributes for the inner element of the crumb (by default, to @@ -136,14 +136,16 @@ public function prepend($title, $url = null, array $options = []) * Insert a crumb at a specific index. * * If the index already exists, the new crumb will be inserted, - * and the existing element will be shifted one index greater. - * If the index is out of bounds, it will throw an exception. + * before the existing element, shifting the existing element one index + * greater than before. + * + * If the index is out of bounds, an exception will be thrown. * * @param int $index The index to insert at. * @param string $title Title of the crumb. - * @param string|array|null $url URL of the crumb. Either a string, an array of route params to pass to + * @param array|string|null $url URL of the crumb. Either a string, an array of route params to pass to * Url::build() or null / empty if the crumb does not have a link. - * @param array $options Array of options. These options will be used as attributes HTML attribute the crumb will + * @param array $options Array of options. These options will be used as attributes HTML attribute the crumb will * be rendered in (a
  • tag by default). It accepts two special keys: * * - *innerAttrs*: An array that allows you to define attributes for the inner element of the crumb (by default, to @@ -154,7 +156,7 @@ public function prepend($title, $url = null, array $options = []) */ public function insertAt(int $index, string $title, $url = null, array $options = []) { - if (!isset($this->crumbs[$index])) { + if (!isset($this->crumbs[$index]) && $index !== count($this->crumbs)) { throw new LogicException(sprintf("No crumb could be found at index '%s'", $index)); } @@ -171,9 +173,9 @@ public function insertAt(int $index, string $title, $url = null, array $options * * @param string $matchingTitle The title of the crumb you want to insert this one before. * @param string $title Title of the crumb. - * @param string|array|null $url URL of the crumb. Either a string, an array of route params to pass to + * @param array|string|null $url URL of the crumb. Either a string, an array of route params to pass to * Url::build() or null / empty if the crumb does not have a link. - * @param array $options Array of options. These options will be used as attributes HTML attribute the crumb will + * @param array $options Array of options. These options will be used as attributes HTML attribute the crumb will * be rendered in (a
  • tag by default). It accepts two special keys: * * - *innerAttrs*: An array that allows you to define attributes for the inner element of the crumb (by default, to @@ -201,9 +203,9 @@ public function insertBefore(string $matchingTitle, string $title, $url = null, * * @param string $matchingTitle The title of the crumb you want to insert this one after. * @param string $title Title of the crumb. - * @param string|array|null $url URL of the crumb. Either a string, an array of route params to pass to + * @param array|string|null $url URL of the crumb. Either a string, an array of route params to pass to * Url::build() or null / empty if the crumb does not have a link. - * @param array $options Array of options. These options will be used as attributes HTML attribute the crumb will + * @param array $options Array of options. These options will be used as attributes HTML attribute the crumb will * be rendered in (a
  • tag by default). It accepts two special keys: * * - *innerAttrs*: An array that allows you to define attributes for the inner element of the crumb (by default, to @@ -248,9 +250,9 @@ public function reset() /** * Renders the breadcrumbs trail. * - * @param array $attributes Array of attributes applied to the `wrapper` template. Accepts the `templateVars` key to + * @param array $attributes Array of attributes applied to the `wrapper` template. Accepts the `templateVars` key to * allow the insertion of custom template variable in the template. - * @param array $separator Array of attributes for the `separator` template. + * @param array $separator Array of attributes for the `separator` template. * Possible properties are : * * - *separator* The string to be displayed as a separator diff --git a/app/vendor/cakephp/cakephp/src/View/Helper/FlashHelper.php b/app/vendor/cakephp/cakephp/src/View/Helper/FlashHelper.php index 78e2f252..86e8a488 100644 --- a/app/vendor/cakephp/cakephp/src/View/Helper/FlashHelper.php +++ b/app/vendor/cakephp/cakephp/src/View/Helper/FlashHelper.php @@ -62,7 +62,7 @@ class FlashHelper extends Helper * element. * * @param string $key The [Flash.]key you are rendering in the view. - * @param array $options Additional options to use for the creation of this flash message. + * @param array $options Additional options to use for the creation of this flash message. * Supports the 'params', and 'element' keys that are used in the helper. * @return string|null Rendered flash message or null if flash key does not exist * in session. @@ -86,7 +86,7 @@ public function render(string $key = 'flash', array $options = []): ?string /** * Event listeners. * - * @return array + * @return array */ public function implementedEvents(): array { diff --git a/app/vendor/cakephp/cakephp/src/View/Helper/FormHelper.php b/app/vendor/cakephp/cakephp/src/View/Helper/FormHelper.php index 322e9a93..1486b1cd 100644 --- a/app/vendor/cakephp/cakephp/src/View/Helper/FormHelper.php +++ b/app/vendor/cakephp/cakephp/src/View/Helper/FormHelper.php @@ -60,7 +60,7 @@ class FormHelper extends Helper /** * Default config for the helper. * - * @var array + * @var array */ protected $_defaultConfig = [ 'idPrefix' => null, @@ -95,7 +95,7 @@ class FormHelper extends Helper // Wrapper container for checkboxes. 'checkboxWrapper' => '
    {{label}}
    ', // Error message wrapper elements. - 'error' => '
    {{content}}
    ', + 'error' => '
    {{content}}
    ', // Container for error items. 'errorList' => '
      {{content}}
    ', // Error item wrapper. @@ -158,7 +158,7 @@ class FormHelper extends Helper /** * Default widgets * - * @var array + * @var array> */ protected $_defaultWidgets = [ 'button' => ['Button'], @@ -226,7 +226,7 @@ class FormHelper extends Helper * `data` - Corresponds to request data (POST/PUT). * `query` - Corresponds to request's query string. * - * @var string[] + * @var array */ protected $supportedValueSources = ['context', 'data', 'query']; @@ -234,14 +234,14 @@ class FormHelper extends Helper * The default sources. * * @see FormHelper::$supportedValueSources for valid values. - * @var string[] + * @var array */ protected $_valueSources = ['data', 'context']; /** * Grouped input types. * - * @var string[] + * @var array */ protected $_groupedInputTypes = ['radio', 'multicheckbox']; @@ -256,7 +256,7 @@ class FormHelper extends Helper * Construct the widgets and binds the default context providers * * @param \Cake\View\View $view The View this helper is being attached to. - * @param array $config Configuration settings for the helper. + * @param array $config Configuration settings for the helper. */ public function __construct(View $view, array $config = []) { @@ -358,7 +358,7 @@ public function contextFactory(?ContextFactory $instance = null, array $contexts * @param mixed $context The context for which the form is being defined. * Can be a ContextInterface instance, ORM entity, ORM resultset, or an * array of meta data. You can use `null` to make a context-less form. - * @param array $options An array of html attributes and options. + * @param array $options An array of html attributes and options. * @return string An formatted opening FORM tag. * @link https://book.cakephp.org/4/en/views/helpers/form.html#Cake\View\Helper\FormHelper::create */ @@ -481,8 +481,8 @@ public function create($context = null, array $options = []): string * Create the URL for a form based on the options. * * @param \Cake\View\Form\ContextInterface $context The context object to use. - * @param array $options An array of options from create() - * @return string|array The action attribute for the form. + * @param array $options An array of options from create() + * @return array|string The action attribute for the form. */ protected function _formUrl(ContextInterface $context, array $options) { @@ -514,7 +514,7 @@ protected function _formUrl(ContextInterface $context, array $options) /** * Correctly store the last created form action URL. * - * @param string|array|null $url The URL of the last form. + * @param array|string|null $url The URL of the last form. * @return void */ protected function _lastAction($url = null): void @@ -555,7 +555,7 @@ protected function _csrfField(): string * * Resets some parts of the state, shared among multiple FormHelper::create() calls, to defaults. * - * @param array $secureAttributes Secure attributes which will be passed as HTML attributes + * @param array $secureAttributes Secure attributes which will be passed as HTML attributes * into the hidden input elements generated for the Security Component. * @return string A closing FORM tag. * @link https://book.cakephp.org/4/en/views/helpers/form.html#closing-the-form @@ -589,7 +589,7 @@ public function end(array $secureAttributes = []): string * * @param array $fields If set specifies the list of fields to be added to * FormProtector for generating the hash. - * @param array $secureAttributes will be passed as HTML attributes into the hidden + * @param array $secureAttributes will be passed as HTML attributes into the hidden * input elements generated for the Security Component. * @return string A hidden input field with a security hash, or empty string when * secured forms are not in use. @@ -656,7 +656,7 @@ public function unlockField(string $name) /** * Create FormProtector instance. * - * @param array $formTokenData Token data. + * @param array $formTokenData Token data. * @return \Cake\Form\FormProtector */ protected function createFormProtector(array $formTokenData): FormProtector @@ -707,12 +707,12 @@ public function isFieldError(string $field): bool * * ### Options: * - * - `escape` boolean - Whether or not to html escape the contents of the error. + * - `escape` boolean - Whether to html escape the contents of the error. * * @param string $field A field name, like "modelname.fieldname" - * @param string|array|null $text Error message as string or array of messages. If an array, + * @param array|string|null $text Error message as string or array of messages. If an array, * it should be a hash of key names => messages. - * @param array $options See above. + * @param array $options See above. * @return string Formatted errors or ''. * @link https://book.cakephp.org/4/en/views/helpers/form.html#displaying-and-checking-errors */ @@ -766,7 +766,10 @@ public function error(string $field, $text = null, array $options = []): string } } - return $this->formatTemplate('error', ['content' => $error]); + return $this->formatTemplate('error', [ + 'content' => $error, + 'id' => $this->_domId($field) . '-error', + ]); } /** @@ -823,7 +826,7 @@ public function error(string $field, $text = null, array $options = []): string * @param string|null $text Text that will appear in the label field. If * $text is left undefined the text will be inflected from the * fieldName. - * @param array $options An array of HTML attributes. + * @param array $options An array of HTML attributes. * @return string The formatted LABEL element * @link https://book.cakephp.org/4/en/views/helpers/form.html#creating-labels */ @@ -886,7 +889,7 @@ public function label(string $fieldName, ?string $text = null, array $options = * * @param array $fields An array of customizations for the fields that will be * generated. This array allows you to set custom types, labels, or other options. - * @param array $options Options array. Valid keys are: + * @param array $options Options array. Valid keys are: * * - `fieldset` Set to false to disable the fieldset. You can also pass an array of params to be * applied as HTML attributes to the fieldset tag. If you pass an empty array, the fieldset will @@ -923,7 +926,7 @@ public function allControls(array $fields = [], array $options = []): string * * @param array $fields An array of the fields to generate. This array allows * you to set custom types, labels, or other options. - * @param array $options Options array. Valid keys are: + * @param array $options Options array. Valid keys are: * * - `fieldset` Set to false to disable the fieldset. You can also pass an * array of params to be applied as HTML attributes to the fieldset tag. @@ -953,7 +956,7 @@ public function controls(array $fields, array $options = []): string * Wrap a set of inputs in a fieldset * * @param string $fields the form inputs to wrap in a fieldset - * @param array $options Options array. Valid keys are: + * @param array $options Options array. Valid keys are: * * - `fieldset` Set to false to disable the fieldset. You can also pass an array of params to be * applied as HTML attributes to the fieldset tag. If you pass an empty array, the fieldset will @@ -964,17 +967,11 @@ public function controls(array $fields, array $options = []): string */ public function fieldset(string $fields = '', array $options = []): string { - $fieldset = $legend = true; + $legend = $options['legend'] ?? true; + $fieldset = $options['fieldset'] ?? true; $context = $this->_getContext(); $out = $fields; - if (isset($options['legend'])) { - $legend = $options['legend']; - } - if (isset($options['fieldset'])) { - $fieldset = $options['fieldset']; - } - if ($legend === true) { $isCreate = $context->isCreate(); $modelName = Inflector::humanize( @@ -1029,7 +1026,7 @@ public function fieldset(string $fields = '', array $options = []): string * widget is checked * * @param string $fieldName This should be "modelname.fieldname" - * @param array $options Each type of input takes different options. + * @param array $options Each type of input takes different options. * @return string Completed form widget. * @link https://book.cakephp.org/4/en/views/helpers/form.html#creating-form-inputs * @psalm-suppress InvalidReturnType @@ -1060,6 +1057,31 @@ public function control(string $fieldName, array $options = []): string } unset($options['templates']); + // Hidden inputs don't need aria. + // Multiple checkboxes can't have aria generated for them at this layer. + if ($options['type'] !== 'hidden' && ($options['type'] !== 'select' && !isset($options['multiple']))) { + $isFieldError = $this->isFieldError($fieldName); + $options += [ + 'aria-required' => $options['required'] == true ? 'true' : null, + 'aria-invalid' => $isFieldError ? 'true' : null, + ]; + // Don't include aria-describedby unless we have a good chance of + // having error message show up. + if ( + strpos($templater->get('error'), '{{id}}') !== false && + strpos($templater->get('inputContainerError'), '{{error}}') !== false + ) { + $options += [ + 'aria-describedby' => $isFieldError ? $this->_domId($fieldName) . '-error' : null, + ]; + } + if (isset($options['placeholder']) && $options['label'] === false) { + $options += [ + 'aria-label' => $options['placeholder'], + ]; + } + } + $error = null; $errorSuffix = ''; if ($options['type'] !== 'hidden' && $options['error'] !== false) { @@ -1126,7 +1148,7 @@ public function control(string $fieldName, array $options = []): string /** * Generates an group template element * - * @param array $options The options for group template + * @param array $options The options for group template * @return string The generated group template */ protected function _groupTemplate(array $options): string @@ -1147,7 +1169,7 @@ protected function _groupTemplate(array $options): string /** * Generates an input container template * - * @param array $options The options for input container template + * @param array $options The options for input container template * @return string The generated input container template */ protected function _inputContainerTemplate(array $options): string @@ -1170,8 +1192,8 @@ protected function _inputContainerTemplate(array $options): string * Generates an input element * * @param string $fieldName the field name - * @param array $options The options for the input element - * @return string|array The generated input element string + * @param array $options The options for the input element + * @return array|string The generated input element string * or array if checkbox() is called with option 'hiddenField' set to '_split'. */ protected function _getInput(string $fieldName, array $options) @@ -1201,8 +1223,8 @@ protected function _getInput(string $fieldName, array $options) * Generates input options array * * @param string $fieldName The name of the field to parse options for. - * @param array $options Options list. - * @return array Options + * @param array $options Options list. + * @return array Options */ protected function _parseOptions(string $fieldName, array $options): array { @@ -1223,7 +1245,7 @@ protected function _parseOptions(string $fieldName, array $options): array * variables that can be found in the view template * * @param string $fieldName the name of the field to guess a type for - * @param array $options the options passed to the input method + * @param array $options the options passed to the input method * @return string */ protected function _inputType(string $fieldName, array $options): string @@ -1271,7 +1293,7 @@ protected function _inputType(string $fieldName, array $options): string * and sets the value to the 'options' key in the options array. * * @param string $fieldName The name of the field to find options for. - * @param array $options Options list. + * @param array $options Options list. * @return array */ protected function _optionsOptions(string $fieldName, array $options): array @@ -1308,10 +1330,10 @@ protected function _optionsOptions(string $fieldName, array $options): array * Magically set option type and corresponding options * * @param string $fieldName The name of the field to generate options for. - * @param array $options Options list. - * @param bool $allowOverride Whether or not it is allowed for this method to + * @param array $options Options list. + * @param bool $allowOverride Whether it is allowed for this method to * overwrite the 'type' key in options. - * @return array + * @return array */ protected function _magicOptions(string $fieldName, array $options, bool $allowOverride): array { @@ -1341,8 +1363,8 @@ protected function _magicOptions(string $fieldName, array $options, bool $allowO * Set required attribute and custom validity JS. * * @param string $fieldName The name of the field to generate options for. - * @param array $options Options list. - * @return array Modified options list. + * @param array $options Options list. + * @return array Modified options list. */ protected function setRequiredAndCustomValidity(string $fieldName, array $options) { @@ -1373,7 +1395,7 @@ protected function setRequiredAndCustomValidity(string $fieldName, array $option * Generate label for input * * @param string $fieldName The name of the field to generate label for. - * @param array $options Options list. + * @param array $options Options list. * @return string|false Generated label element or false. */ protected function _getLabel(string $fieldName, array $options) @@ -1382,10 +1404,7 @@ protected function _getLabel(string $fieldName, array $options) return false; } - $label = null; - if (isset($options['label'])) { - $label = $options['label']; - } + $label = $options['label'] ?? null; if ($label === false && $options['type'] === 'checkbox') { return $options['input']; @@ -1401,7 +1420,7 @@ protected function _getLabel(string $fieldName, array $options) * Extracts a single option from an options array. * * @param string $name The name of the option to pull out. - * @param array $options The array of options you want to extract. + * @param array $options The array of options you want to extract. * @param mixed $default The default option value * @return mixed the contents of the option or default */ @@ -1421,8 +1440,8 @@ protected function _extractOption(string $name, array $options, $default = null) * used instead of the generated values if present. * * @param string $fieldName The name of the field to generate label for. - * @param string|array|null $label Label text or array with label attributes. - * @param array $options Options for the label element. + * @param array|string|null $label Label text or array with label attributes. + * @param array $options Options for the label element. * @return string Generated label element */ protected function _inputLabel(string $fieldName, $label = null, array $options = []): string @@ -1461,16 +1480,16 @@ protected function _inputLabel(string $fieldName, $label = null, array $options * * - `value` - the value of the checkbox * - `checked` - boolean indicate that this checkbox is checked. - * - `hiddenField` - boolean to indicate if you want the results of checkbox() to include - * a hidden input with a value of ''. + * - `hiddenField` - boolean|string. Set to false to disable a hidden input from + * being generated. Passing a string will define the hidden input value. * - `disabled` - create a disabled input. * - `default` - Set the default value for the checkbox. This allows you to start checkboxes * as checked, without having to check the POST data. A matching POST data value, will overwrite * the default value. * * @param string $fieldName Name of a field, like this "modelname.fieldname" - * @param array $options Array of HTML attributes. - * @return string[]|string An HTML text input element. + * @param array $options Array of HTML attributes. + * @return array|string An HTML text input element. * @link https://book.cakephp.org/4/en/views/helpers/form.html#creating-checkboxes */ public function checkbox(string $fieldName, array $options = []) @@ -1484,12 +1503,12 @@ public function checkbox(string $fieldName, array $options = []) $options['value'] = $value; $output = ''; - if ($options['hiddenField']) { + if ($options['hiddenField'] !== false && is_scalar($options['hiddenField'])) { $hiddenOptions = [ 'name' => $options['name'], 'value' => $options['hiddenField'] !== true && $options['hiddenField'] !== '_split' - ? $options['hiddenField'] : '0', + ? (string)$options['hiddenField'] : '0', 'form' => $options['form'] ?? null, 'secure' => false, ]; @@ -1518,8 +1537,9 @@ public function checkbox(string $fieldName, array $options = []) * - `label` - Either `false` to disable label around the widget or an array of attributes for * the label tag. `selected` will be added to any classes e.g. `'class' => 'myclass'` where widget * is checked - * - `hiddenField` - boolean to indicate if you want the results of radio() to include - * a hidden input with a value of ''. This is useful for creating radio sets that are non-continuous. + * - `hiddenField` - boolean|string. Set to false to not include a hidden input with a value of ''. + * Can also be a string to set the value of the hidden input. This is useful for creating + * radio sets that are non-continuous. * - `disabled` - Set to `true` or `disabled` to disable all the radio buttons. Use an array of * values to disable specific radio buttons. * - `empty` - Set to `true` to create an input with the value '' as the first option. When `true` @@ -1527,7 +1547,7 @@ public function checkbox(string $fieldName, array $options = []) * * @param string $fieldName Name of a field, like this "modelname.fieldname" * @param iterable $options Radio button options array. - * @param array $attributes Array of attributes. + * @param array $attributes Array of attributes. * @return string Completed radio widget set. * @link https://book.cakephp.org/4/en/views/helpers/form.html#creating-radio-buttons */ @@ -1543,9 +1563,9 @@ public function radio(string $fieldName, iterable $options = [], array $attribut $radio = $this->widget('radio', $attributes); $hidden = ''; - if ($hiddenField) { + if ($hiddenField !== false && is_scalar($hiddenField)) { $hidden = $this->hidden($fieldName, [ - 'value' => $hiddenField === true ? '' : $hiddenField, + 'value' => $hiddenField === true ? '' : (string)$hiddenField, 'form' => $attributes['form'] ?? null, 'name' => $attributes['name'], ]); @@ -1579,16 +1599,11 @@ public function radio(string $fieldName, iterable $options = [], array $attribut */ public function __call(string $method, array $params) { - $options = []; if (empty($params)) { throw new CakeException(sprintf('Missing field name for FormHelper::%s', $method)); } - if (isset($params[1])) { - $options = $params[1]; - } - if (!isset($options['type'])) { - $options['type'] = $method; - } + $options = $params[1] ?? []; + $options['type'] = $options['type'] ?? $method; $options = $this->_initInputField($params[0], $options); return $this->widget($options['type'], $options); @@ -1599,10 +1614,10 @@ public function __call(string $method, array $params) * * ### Options: * - * - `escape` - Whether or not the contents of the textarea should be escaped. Defaults to true. + * - `escape` - Whether the contents of the textarea should be escaped. Defaults to true. * * @param string $fieldName Name of a field, in the form "modelname.fieldname" - * @param array $options Array of HTML attributes, and special options above. + * @param array $options Array of HTML attributes, and special options above. * @return string A generated HTML text input element * @link https://book.cakephp.org/4/en/views/helpers/form.html#creating-textareas */ @@ -1618,7 +1633,7 @@ public function textarea(string $fieldName, array $options = []): string * Creates a hidden input field. * * @param string $fieldName Name of a field, in the form of "modelname.fieldname" - * @param array $options Array of HTML attributes. + * @param array $options Array of HTML attributes. * @return string A generated hidden input * @link https://book.cakephp.org/4/en/views/helpers/form.html#creating-hidden-inputs */ @@ -1651,7 +1666,7 @@ public function hidden(string $fieldName, array $options = []): string * Creates file input widget. * * @param string $fieldName Name of a field, in the form "modelname.fieldname" - * @param array $options Array of HTML attributes. + * @param array $options Array of HTML attributes. * @return string A generated file input. * @link https://book.cakephp.org/4/en/views/helpers/form.html#creating-file-inputs */ @@ -1676,7 +1691,7 @@ public function file(string $fieldName, array $options = []): string * - `confirm` - Confirm message to show. Form execution will only continue if confirmed then. * * @param string $title The button's caption. Not automatically HTML encoded - * @param array $options Array of options and HTML attributes. + * @param array $options Array of options and HTML attributes. * @return string A HTML button tag. * @link https://book.cakephp.org/4/en/views/helpers/form.html#creating-button-elements */ @@ -1721,8 +1736,8 @@ public function button(string $title, array $options = []): string * - `confirm` - Confirm message to show. Form execution will only continue if confirmed then. * * @param string $title The button's caption. Not automatically HTML encoded - * @param string|array $url URL as string or array - * @param array $options Array of options and HTML attributes. + * @param array|string $url URL as string or array + * @param array $options Array of options and HTML attributes. * @return string A HTML button tag. * @link https://book.cakephp.org/4/en/views/helpers/form.html#creating-standalone-buttons-and-post-links */ @@ -1773,9 +1788,9 @@ public function postButton(string $title, $url, array $options = []): string * - The option `onclick` will be replaced. * * @param string $title The content to be wrapped by tags. - * @param string|array|null $url Cake-relative URL or array of URL parameters, or + * @param array|string|null $url Cake-relative URL or array of URL parameters, or * external URL (starts with http://) - * @param array $options Array of HTML attributes. + * @param array $options Array of HTML attributes. * @return string An `` element. * @link https://book.cakephp.org/4/en/views/helpers/form.html#creating-standalone-buttons-and-post-links */ @@ -1886,7 +1901,7 @@ public function postLink(string $title, $url = null, array $options = []): strin * extension .jpg, .jpe, .jpeg, .gif, .png use an image if the extension * exists, AND the first character is /, image is relative to webroot, * OR if the first character is not /, image is relative to webroot/img. - * @param array $options Array of options. See above. + * @param array $options Array of options. See above. * @return string A HTML submit button * @link https://book.cakephp.org/4/en/views/helpers/form.html#creating-buttons-and-submit-elements */ @@ -2006,7 +2021,7 @@ public function submit(?string $caption = null, array $options = []): string * @param string $fieldName Name attribute of the SELECT * @param iterable $options Array of the OPTION elements (as 'value'=>'Text' pairs) to be used in the * SELECT element - * @param array $attributes The HTML attributes of the select element. + * @param array $attributes The HTML attributes of the select element. * @return string Formatted SELECT element * @see \Cake\View\Helper\FormHelper::multiCheckbox() for creating multiple checkboxes. * @link https://book.cakephp.org/4/en/views/helpers/form.html#creating-select-pickers @@ -2085,7 +2100,7 @@ public function select(string $fieldName, iterable $options = [], array $attribu * @param string $fieldName Name attribute of the SELECT * @param iterable $options Array of the OPTION elements * (as 'value'=>'Text' pairs) to be used in the checkboxes element. - * @param array $attributes The HTML attributes of the select element. + * @param array $attributes The HTML attributes of the select element. * @return string Formatted SELECT element * @see \Cake\View\Helper\FormHelper::select() for supported option formats. */ @@ -2130,7 +2145,7 @@ public function multiCheckbox(string $fieldName, iterable $options, array $attri * - `min` The min year to appear in the select element. * * @param string $fieldName The field name. - * @param array $options Options & attributes for the select elements. + * @param array $options Options & attributes for the select elements. * @return string Completed year select input * @link https://book.cakephp.org/4/en/views/helpers/form.html#creating-year-inputs */ @@ -2153,7 +2168,7 @@ public function year(string $fieldName, array $options = []): string * See dateTime() options. * * @param string $fieldName The field name. - * @param array $options Array of options or HTML attributes. + * @param array $options Array of options or HTML attributes. * @return string */ public function month(string $fieldName, array $options = []): string @@ -2177,7 +2192,7 @@ public function month(string $fieldName, array $options = []): string * If set to `true` current datetime will be used. * * @param string $fieldName The field name. - * @param array $options Array of options or HTML attributes. + * @param array $options Array of options or HTML attributes. * @return string */ public function dateTime(string $fieldName, array $options = []): string @@ -2200,7 +2215,7 @@ public function dateTime(string $fieldName, array $options = []): string * See dateTime() options. * * @param string $fieldName The field name. - * @param array $options Array of options or HTML attributes. + * @param array $options Array of options or HTML attributes. * @return string */ public function time(string $fieldName, array $options = []): string @@ -2222,7 +2237,7 @@ public function time(string $fieldName, array $options = []): string * See dateTime() options. * * @param string $fieldName The field name. - * @param array $options Array of options or HTML attributes. + * @param array $options Array of options or HTML attributes. * @return string */ public function date(string $fieldName, array $options = []): string @@ -2243,7 +2258,7 @@ public function date(string $fieldName, array $options = []): string * * ### Options * - * - `secure` - boolean whether or not the field should be added to the security fields. + * - `secure` - boolean whether the field should be added to the security fields. * Disabling the field using the `disabled` option, will also omit the field from being * part of the hashed key. * - `default` - mixed - The value to use if there is no value in the form's context. @@ -2258,8 +2273,8 @@ public function date(string $fieldName, array $options = []): string * can be passed to a form widget to generate the actual input. * * @param string $field Name of the field to initialize options for. - * @param array $options Array of options to append options into. - * @return array Array of options for the input. + * @param array|array $options Array of options to append options into. + * @return array Array of options for the input. */ protected function _initInputField(string $field, array $options = []): array { @@ -2276,6 +2291,7 @@ protected function _initInputField(string $field, array $options = []): array $disabledIndex = array_search('disabled', $options, true); if (is_int($disabledIndex)) { + deprecationWarning('Using non-associative options is deprecated, use `\'disabled\' => true` instead.'); unset($options[$disabledIndex]); $options['disabled'] = true; } @@ -2314,9 +2330,6 @@ protected function _initInputField(string $field, array $options = []): array if ($isDisabled) { $options['secure'] = self::SECURE_SKIP; } - if ($options['secure'] === self::SECURE_SKIP) { - return $options; - } return $options; } @@ -2324,8 +2337,8 @@ protected function _initInputField(string $field, array $options = []): array /** * Determine if a field is disabled. * - * @param array $options The option set. - * @return bool Whether or not the field is disabled. + * @param array $options The option set. + * @return bool Whether the field is disabled. */ protected function _isDisabled(array $options): bool { @@ -2421,7 +2434,7 @@ protected function _getContext($data = []): ContextInterface * Allows you to add or replace widget instances with custom code. * * @param string $name The name of the widget. e.g. 'text'. - * @param array|\Cake\View\Widget\WidgetInterface $spec Either a string class + * @param \Cake\View\Widget\WidgetInterface|array $spec Either a string class * name or an object implementing the WidgetInterface. * @return void */ @@ -2480,7 +2493,7 @@ public function resetTemplates(): void /** * Event listeners. * - * @return array + * @return array */ public function implementedEvents(): array { @@ -2492,7 +2505,7 @@ public function implementedEvents(): array * * Returns a list, but at least one item, of valid sources, such as: `'context'`, `'data'` and `'query'`. * - * @return string[] List of value sources. + * @return array List of value sources. */ public function getValueSources(): array { @@ -2502,7 +2515,7 @@ public function getValueSources(): array /** * Validate value sources. * - * @param string[] $sources A list of strings identifying a source. + * @param array $sources A list of strings identifying a source. * @return void * @throws \InvalidArgumentException If sources list contains invalid value. */ @@ -2526,7 +2539,7 @@ protected function validateValueSources(array $sources): void * Order sets priority. * * @see FormHelper::$supportedValueSources for valid values. - * @param string|string[] $sources A string or a list of strings identifying a source. + * @param array|string $sources A string or a list of strings identifying a source. * @return $this * @throws \InvalidArgumentException If sources list contains invalid value. */ @@ -2544,7 +2557,7 @@ public function setValueSources($sources) * Gets a single field value from the sources available. * * @param string $fieldname The fieldname to fetch the value for. - * @param array $options The options containing default values. + * @param array $options The options containing default values. * @return mixed Field value derived from sources or defaults. */ public function getSourceValue(string $fieldname, array $options = []) diff --git a/app/vendor/cakephp/cakephp/src/View/Helper/HtmlHelper.php b/app/vendor/cakephp/cakephp/src/View/Helper/HtmlHelper.php index 08996222..1a2df5cd 100644 --- a/app/vendor/cakephp/cakephp/src/View/Helper/HtmlHelper.php +++ b/app/vendor/cakephp/cakephp/src/View/Helper/HtmlHelper.php @@ -42,7 +42,7 @@ class HtmlHelper extends Helper /** * Default config for this class * - * @var array + * @var array */ protected $_defaultConfig = [ 'templates' => [ @@ -81,14 +81,14 @@ class HtmlHelper extends Helper /** * Names of script & css files that have been included once * - * @var array + * @var array */ protected $_includedAssets = []; /** * Options for the currently opened script block buffer if any. * - * @var array + * @var array */ protected $_scriptBlockOptions = []; @@ -124,10 +124,10 @@ class HtmlHelper extends Helper * - `block` - Set to true to append output to view block "meta" or provide * custom block name. * - * @param string|array $type The title of the external resource, Or an array of attributes for a + * @param array|string $type The title of the external resource, Or an array of attributes for a * custom meta tag. - * @param string|array|null $content The address of the external resource or string for content attribute - * @param array $options Other attributes for the generated tag. If the type attribute is html, + * @param array|string|null $content The address of the external resource or string for content attribute + * @param array $options Other attributes for the generated tag. If the type attribute is html, * rss, atom, or icon, the mime-type is returned. * @return string|null A completed `` element, or null if the element was sent to a block. * @link https://book.cakephp.org/4/en/views/helpers/html.html#creating-meta-tags @@ -242,11 +242,11 @@ public function charset(?string $charset = null): string * over value of `escape`) * - `confirm` JavaScript confirmation message. * - * @param string|array $title The content to be wrapped by `` tags. + * @param array|string $title The content to be wrapped by `` tags. * Can be an array if $url is null. If $url is null, $title will be used as both the URL and title. - * @param string|array|null $url Cake-relative URL or array of URL parameters, or + * @param array|string|null $url Cake-relative URL or array of URL parameters, or * external URL (starts with http://) - * @param array $options Array of options and HTML attributes. + * @param array $options Array of options and HTML attributes. * @return string An `` element. * @link https://book.cakephp.org/4/en/views/helpers/html.html#creating-links */ @@ -313,10 +313,10 @@ public function link($title, $url = null, array $options = []): string * @param string $path Cake-relative route path. * @param array $params An array specifying any additional parameters. * Can be also any special parameters supported by `Router::url()`. - * @param array $options Array of options and HTML attributes. + * @param array $options Array of options and HTML attributes. * @return string An `` element. * @see \Cake\Routing\Router::pathUrl() - * @link https://book.cakephp.org/3/en/views/helpers/html.html#creating-links + * @link https://book.cakephp.org/4/en/views/helpers/html.html#creating-links */ public function linkFromPath(string $title, string $path, array $params = [], array $options = []): string { @@ -356,23 +356,32 @@ public function linkFromPath(string $title, string $path, array $params = [], ar * * - `block` Set to true to append output to view block "css" or provide * custom block name. - * - `once` Whether or not the css file should be checked for uniqueness. If true css + * - `once` Whether the css file should be checked for uniqueness. If true css * files will only be included once, use false to allow the same * css to be included more than once per request. * - `plugin` False value will prevent parsing path as a plugin * - `rel` Defaults to 'stylesheet'. If equal to 'import' the stylesheet will be imported. * - `fullBase` If true the URL will get a full address for the css file. * - * @param string|string[] $path The name of a CSS style sheet or an array containing names of + * All other options will be treated as HTML attributes. If the request contains a + * `cspStyleNonce` attribute, that value will be applied as the `nonce` attribute on the + * generated HTML. + * + * @param array|string $path The name of a CSS style sheet or an array containing names of * CSS stylesheets. If `$path` is prefixed with '/', the path will be relative to the webroot * of your application. Otherwise, the path will be relative to your CSS path, usually webroot/css. - * @param array $options Array of options and HTML arguments. + * @param array $options Array of options and HTML arguments. * @return string|null CSS `` or ` - - -

    Hello CSS!

    - - - {% endapply %} - -You can also add some stylesheets by passing them as arguments to the filter: - -.. code-block:: html+twig - - {% apply inline_css(source("some_styles.css"), source("another.css")) %} - - -

    Hello CSS!

    - - - {% endapply %} - -Styles loaded via the filter override the styles defined in the `` - {% endblock %} - {% block content %} -

    Index

    -

    - Welcome on my awesome homepage. -

    - {% endblock %} - -The ``extends`` tag is the key here. It tells the template engine that this -template "extends" another template. When the template system evaluates this -template, first it locates the parent. The extends tag should be the first tag -in the template. - -Note that since the child template doesn't define the ``footer`` block, the -value from the parent template is used instead. - -You can't define multiple ``block`` tags with the same name in the same -template. This limitation exists because a block tag works in "both" -directions. That is, a block tag doesn't just provide a hole to fill - it also -defines the content that fills the hole in the *parent*. If there were two -similarly-named ``block`` tags in a template, that template's parent wouldn't -know which one of the blocks' content to use. - -If you want to print a block multiple times you can however use the -``block`` function: - -.. code-block:: html+twig - - {% block title %}{% endblock %} -

    {{ block('title') }}

    - {% block body %}{% endblock %} - -Parent Blocks -------------- - -It's possible to render the contents of the parent block by using the -:doc:`parent<../functions/parent>` function. This gives back the results of -the parent block: - -.. code-block:: html+twig - - {% block sidebar %} -

    Table Of Contents

    - ... - {{ parent() }} - {% endblock %} - -Named Block End-Tags --------------------- - -Twig allows you to put the name of the block after the end tag for better -readability (the name after the ``endblock`` word must match the block name): - -.. code-block:: twig - - {% block sidebar %} - {% block inner_sidebar %} - ... - {% endblock inner_sidebar %} - {% endblock sidebar %} - -Block Nesting and Scope ------------------------ - -Blocks can be nested for more complex layouts. Per default, blocks have access -to variables from outer scopes: - -.. code-block:: html+twig - - {% for item in seq %} -
  • {% block loop_item %}{{ item }}{% endblock %}
  • - {% endfor %} - -Block Shortcuts ---------------- - -For blocks with little content, it's possible to use a shortcut syntax. The -following constructs do the same thing: - -.. code-block:: twig - - {% block title %} - {{ page_title|title }} - {% endblock %} - -.. code-block:: twig - - {% block title page_title|title %} - -Dynamic Inheritance -------------------- - -Twig supports dynamic inheritance by using a variable as the base template: - -.. code-block:: twig - - {% extends some_var %} - -If the variable evaluates to a ``\Twig\Template`` or a ``\Twig\TemplateWrapper`` -instance, Twig will use it as the parent template:: - - // {% extends layout %} - - $layout = $twig->load('some_layout_template.twig'); - - $twig->display('template.twig', ['layout' => $layout]); - -You can also provide a list of templates that are checked for existence. The -first template that exists will be used as a parent: - -.. code-block:: twig - - {% extends ['layout.html', 'base_layout.html'] %} - -Conditional Inheritance ------------------------ - -As the template name for the parent can be any valid Twig expression, it's -possible to make the inheritance mechanism conditional: - -.. code-block:: twig - - {% extends standalone ? "minimum.html" : "base.html" %} - -In this example, the template will extend the "minimum.html" layout template -if the ``standalone`` variable evaluates to ``true``, and "base.html" -otherwise. - -How do blocks work? -------------------- - -A block provides a way to change how a certain part of a template is rendered -but it does not interfere in any way with the logic around it. - -Let's take the following example to illustrate how a block works and more -importantly, how it does not work: - -.. code-block:: html+twig - - {# base.twig #} - {% for post in posts %} - {% block post %} -

    {{ post.title }}

    -

    {{ post.body }}

    - {% endblock %} - {% endfor %} - -If you render this template, the result would be exactly the same with or -without the ``block`` tag. The ``block`` inside the ``for`` loop is just a way -to make it overridable by a child template: - -.. code-block:: html+twig - - {# child.twig #} - {% extends "base.twig" %} - - {% block post %} -
    -
    {{ post.title }}
    -
    {{ post.text }}
    -
    - {% endblock %} - -Now, when rendering the child template, the loop is going to use the block -defined in the child template instead of the one defined in the base one; the -executed template is then equivalent to the following one: - -.. code-block:: html+twig - - {% for post in posts %} -
    -
    {{ post.title }}
    -
    {{ post.text }}
    -
    - {% endfor %} - -Let's take another example: a block included within an ``if`` statement: - -.. code-block:: html+twig - - {% if posts is empty %} - {% block head %} - {{ parent() }} - - - {% endblock head %} - {% endif %} - -Contrary to what you might think, this template does not define a block -conditionally; it just makes overridable by a child template the output of -what will be rendered when the condition is ``true``. - -If you want the output to be displayed conditionally, use the following -instead: - -.. code-block:: html+twig - - {% block head %} - {{ parent() }} - - {% if posts is empty %} - - {% endif %} - {% endblock head %} - -.. seealso:: - - :doc:`block<../functions/block>`, :doc:`block<../tags/block>`, :doc:`parent<../functions/parent>`, :doc:`use<../tags/use>` diff --git a/app/vendor/twig/twig/doc/tags/flush.rst b/app/vendor/twig/twig/doc/tags/flush.rst deleted file mode 100644 index 03d2a367..00000000 --- a/app/vendor/twig/twig/doc/tags/flush.rst +++ /dev/null @@ -1,14 +0,0 @@ -``flush`` -========= - -The ``flush`` tag tells Twig to flush the output buffer: - -.. code-block:: twig - - {% flush %} - -.. note:: - - Internally, Twig uses the PHP `flush`_ function. - -.. _`flush`: https://www.php.net/flush diff --git a/app/vendor/twig/twig/doc/tags/for.rst b/app/vendor/twig/twig/doc/tags/for.rst deleted file mode 100644 index 4517f590..00000000 --- a/app/vendor/twig/twig/doc/tags/for.rst +++ /dev/null @@ -1,141 +0,0 @@ -``for`` -======= - -Loop over each item in a sequence. For example, to display a list of users -provided in a variable called ``users``: - -.. code-block:: html+twig - -

    Members

    -
      - {% for user in users %} -
    • {{ user.username|e }}
    • - {% endfor %} -
    - -.. note:: - - A sequence can be either an array or an object implementing the - ``Traversable`` interface. - -If you do need to iterate over a sequence of numbers, you can use the ``..`` -operator: - -.. code-block:: twig - - {% for i in 0..10 %} - * {{ i }} - {% endfor %} - -The above snippet of code would print all numbers from 0 to 10. - -It can be also useful with letters: - -.. code-block:: twig - - {% for letter in 'a'..'z' %} - * {{ letter }} - {% endfor %} - -The ``..`` operator can take any expression at both sides: - -.. code-block:: twig - - {% for letter in 'a'|upper..'z'|upper %} - * {{ letter }} - {% endfor %} - -.. tip: - - If you need a step different from 1, you can use the ``range`` function - instead. - -The `loop` variable -------------------- - -Inside of a ``for`` loop block you can access some special variables: - -===================== ============================================================= -Variable Description -===================== ============================================================= -``loop.index`` The current iteration of the loop. (1 indexed) -``loop.index0`` The current iteration of the loop. (0 indexed) -``loop.revindex`` The number of iterations from the end of the loop (1 indexed) -``loop.revindex0`` The number of iterations from the end of the loop (0 indexed) -``loop.first`` True if first iteration -``loop.last`` True if last iteration -``loop.length`` The number of items in the sequence -``loop.parent`` The parent context -===================== ============================================================= - -.. code-block:: twig - - {% for user in users %} - {{ loop.index }} - {{ user.username }} - {% endfor %} - -.. note:: - - The ``loop.length``, ``loop.revindex``, ``loop.revindex0``, and - ``loop.last`` variables are only available for PHP arrays, or objects that - implement the ``Countable`` interface. - -The `else` Clause ------------------ - -If no iteration took place because the sequence was empty, you can render a -replacement block by using ``else``: - -.. code-block:: html+twig - -
      - {% for user in users %} -
    • {{ user.username|e }}
    • - {% else %} -
    • no user found
    • - {% endfor %} -
    - -Iterating over Keys -------------------- - -By default, a loop iterates over the values of the sequence. You can iterate -on keys by using the ``keys`` filter: - -.. code-block:: html+twig - -

    Members

    -
      - {% for key in users|keys %} -
    • {{ key }}
    • - {% endfor %} -
    - -Iterating over Keys and Values ------------------------------- - -You can also access both keys and values: - -.. code-block:: html+twig - -

    Members

    -
      - {% for key, user in users %} -
    • {{ key }}: {{ user.username|e }}
    • - {% endfor %} -
    - -Iterating over a Subset ------------------------ - -You might want to iterate over a subset of values. This can be achieved using -the :doc:`slice <../filters/slice>` filter: - -.. code-block:: html+twig - -

    Top Ten Members

    -
      - {% for user in users|slice(0, 10) %} -
    • {{ user.username|e }}
    • - {% endfor %} -
    diff --git a/app/vendor/twig/twig/doc/tags/from.rst b/app/vendor/twig/twig/doc/tags/from.rst deleted file mode 100644 index 96c439aa..00000000 --- a/app/vendor/twig/twig/doc/tags/from.rst +++ /dev/null @@ -1,6 +0,0 @@ -``from`` -======== - -The ``from`` tag imports :doc:`macro<../tags/macro>` names into the current -namespace. The tag is documented in detail in the documentation for the -:doc:`macro<../tags/macro>` tag. diff --git a/app/vendor/twig/twig/doc/tags/if.rst b/app/vendor/twig/twig/doc/tags/if.rst deleted file mode 100644 index 2d747522..00000000 --- a/app/vendor/twig/twig/doc/tags/if.rst +++ /dev/null @@ -1,79 +0,0 @@ -``if`` -====== - -The ``if`` statement in Twig is comparable with the if statements of PHP. - -In the simplest form you can use it to test if an expression evaluates to -``true``: - -.. code-block:: html+twig - - {% if online == false %} -

    Our website is in maintenance mode. Please, come back later.

    - {% endif %} - -You can also test if an array is not empty: - -.. code-block:: html+twig - - {% if users %} -
      - {% for user in users %} -
    • {{ user.username|e }}
    • - {% endfor %} -
    - {% endif %} - -.. note:: - - If you want to test if the variable is defined, use ``if users is - defined`` instead. - -You can also use ``not`` to check for values that evaluate to ``false``: - -.. code-block:: html+twig - - {% if not user.subscribed %} -

    You are not subscribed to our mailing list.

    - {% endif %} - -For multiple conditions, ``and`` and ``or`` can be used: - -.. code-block:: html+twig - - {% if temperature > 18 and temperature < 27 %} -

    It's a nice day for a walk in the park.

    - {% endif %} - -For multiple branches ``elseif`` and ``else`` can be used like in PHP. You can -use more complex ``expressions`` there too: - -.. code-block:: twig - - {% if product.stock > 10 %} - Available - {% elseif product.stock > 0 %} - Only {{ product.stock }} left! - {% else %} - Sold-out! - {% endif %} - -.. note:: - - The rules to determine if an expression is ``true`` or ``false`` are the - same as in PHP; here are the edge cases rules: - - ====================== ==================== - Value Boolean evaluation - ====================== ==================== - 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 - object true - ====================== ==================== diff --git a/app/vendor/twig/twig/doc/tags/import.rst b/app/vendor/twig/twig/doc/tags/import.rst deleted file mode 100644 index f217479f..00000000 --- a/app/vendor/twig/twig/doc/tags/import.rst +++ /dev/null @@ -1,6 +0,0 @@ -``import`` -========== - -The ``import`` tag imports :doc:`macro<../tags/macro>` names in a local -variable. The tag is documented in detail in the documentation for the -:doc:`macro<../tags/macro>` tag. diff --git a/app/vendor/twig/twig/doc/tags/include.rst b/app/vendor/twig/twig/doc/tags/include.rst deleted file mode 100644 index 93fb0371..00000000 --- a/app/vendor/twig/twig/doc/tags/include.rst +++ /dev/null @@ -1,110 +0,0 @@ -``include`` -=========== - -The ``include`` statement includes a template and outputs the rendered content -of that file: - -.. code-block:: twig - - {% include 'header.html' %} - Body - {% include 'footer.html' %} - -.. note:: - - 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 ``include`` function is more "composable": - - .. code-block:: twig - - {# Store a rendered template in a variable #} - {% set content %} - {% include 'template.html' %} - {% endset %} - {# vs #} - {% set content = include('template.html') %} - - {# Apply filter on a rendered template #} - {% apply upper %} - {% include 'template.html' %} - {% endapply %} - {# vs #} - {{ include('template.html')|upper }} - - * The ``include`` function does not impose any specific order for - arguments thanks to :ref:`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 -paths defined by it. - -You can add additional variables by passing them after the ``with`` keyword: - -.. code-block:: twig - - {# template.html will have access to the variables from the current context and the additional ones provided #} - {% include 'template.html' with {'foo': 'bar'} %} - - {% set vars = {'foo': 'bar'} %} - {% include 'template.html' with vars %} - -You can disable access to the context by appending the ``only`` keyword: - -.. code-block:: twig - - {# only the foo variable will be accessible #} - {% include 'template.html' with {'foo': 'bar'} only %} - -.. code-block:: twig - - {# no variables will be accessible #} - {% include 'template.html' only %} - -.. tip:: - - When including a template created by an end user, you should consider - sandboxing it. More information in the :doc:`Twig for Developers<../api>` - chapter and in the :doc:`sandbox<../tags/sandbox>` tag documentation. - -The template name can be any valid Twig expression: - -.. code-block:: twig - - {% 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:: - - // {% include template %} - - $template = $twig->load('some_template.twig'); - - $twig->display('template.twig', ['template' => $template]); - -You can mark an include with ``ignore missing`` in which case Twig will ignore -the statement if the template to be included does not exist. It has to be -placed just after the template name. Here some valid examples: - -.. code-block:: twig - - {% include 'sidebar.html' ignore missing %} - {% include 'sidebar.html' ignore missing with {'foo': 'bar'} %} - {% include 'sidebar.html' ignore missing only %} - -You can also provide a list of templates that are checked for existence before -inclusion. The first template that exists will be included: - -.. code-block:: twig - - {% include ['page_detailed.html', 'page.html'] %} - -If ``ignore missing`` is given, it will fall back to rendering nothing if none -of the templates exist, otherwise it will throw an exception. diff --git a/app/vendor/twig/twig/doc/tags/index.rst b/app/vendor/twig/twig/doc/tags/index.rst deleted file mode 100644 index b3c10408..00000000 --- a/app/vendor/twig/twig/doc/tags/index.rst +++ /dev/null @@ -1,26 +0,0 @@ -Tags -==== - -.. toctree:: - :maxdepth: 1 - - apply - autoescape - block - cache - deprecated - do - embed - extends - flush - for - from - if - import - include - macro - sandbox - set - use - verbatim - with diff --git a/app/vendor/twig/twig/doc/tags/macro.rst b/app/vendor/twig/twig/doc/tags/macro.rst deleted file mode 100644 index 42fc460c..00000000 --- a/app/vendor/twig/twig/doc/tags/macro.rst +++ /dev/null @@ -1,140 +0,0 @@ -``macro`` -========= - -Macros are comparable with functions in regular programming languages. They -are useful to reuse template fragments to not repeat yourself. - -Macros are defined in regular templates. - -Imagine having a generic helper template that define how to render HTML forms -via macros (called ``forms.html``): - -.. code-block:: html+twig - - {% macro input(name, value, type = "text", size = 20) %} - - {% endmacro %} - - {% macro textarea(name, value, rows = 10, cols = 40) %} - - {% endmacro %} - -Each macro argument can have a default value (here ``text`` is the default value -for ``type`` if not provided in the call). - -Macros differ from native PHP functions in a few ways: - -* Arguments of a macro are always optional. - -* If extra positional arguments are passed to a macro, they end up in the - special ``varargs`` variable as a list of values. - -But as with PHP functions, macros don't have access to the current template -variables. - -.. tip:: - - You can pass the whole context as an argument by using the special - ``_context`` variable. - -Importing Macros ----------------- - -There are two ways to import macros. You can import the complete template -containing the macros into a local variable (via the ``import`` tag) or only -import specific macros from the template (via the ``from`` tag). - -To import all macros from a template into a local variable, use the ``import`` -tag: - -.. code-block:: twig - - {% import "forms.html" as forms %} - -The above ``import`` call imports the ``forms.html`` file (which can contain -only macros, or a template and some macros), and import the macros as items of -the ``forms`` local variable. - -The macros can then be called at will in the *current* template: - -.. code-block:: html+twig - -

    {{ forms.input('username') }}

    -

    {{ forms.input('password', null, 'password') }}

    - -Alternatively you can import names from the template into the current namespace -via the ``from`` tag: - -.. code-block:: html+twig - - {% from 'forms.html' import input as input_field, textarea %} - -

    {{ input_field('password', '', 'password') }}

    -

    {{ textarea('comment') }}

    - -.. tip:: - - When macro usages and definitions are in the same template, you don't need to - import the macros as they are automatically available under the special - ``_self`` variable: - - .. code-block:: html+twig - -

    {{ _self.input('password', '', 'password') }}

    - - {% macro input(name, value, type = "text", size = 20) %} - - {% endmacro %} - -Macros Scoping --------------- - -The scoping rules are the same whether you imported macros via ``import`` or -``from``. - -Imported macros are always **local** to the current template. It means that -macros are available in all blocks and other macros defined in the current -template, but they are not available in included templates or child templates; -you need to explicitly re-import macros in each template. - -Imported macros are not available in the body of ``embed`` tags, you need -to explicitly re-import macros inside the tag. - -When calling ``import`` or ``from`` from a ``block`` tag, the imported macros -are only defined in the current block and they override macros defined at the -template level with the same names. - -When calling ``import`` or ``from`` from a ``macro`` tag, the imported macros -are only defined in the current macro and they override macros defined at the -template level with the same names. - -Checking if a Macro is defined ------------------------------- - -You can check if a macro is defined via the ``defined`` test: - -.. code-block:: twig - - {% import "macros.twig" as macros %} - - {% from "macros.twig" import hello %} - - {% if macros.hello is defined -%} - OK - {% endif %} - - {% if hello is defined -%} - OK - {% endif %} - -Named Macro End-Tags --------------------- - -Twig allows you to put the name of the macro after the end tag for better -readability (the name after the ``endmacro`` word must match the macro name): - -.. code-block:: twig - - {% macro input() %} - ... - {% endmacro input %} diff --git a/app/vendor/twig/twig/doc/tags/sandbox.rst b/app/vendor/twig/twig/doc/tags/sandbox.rst deleted file mode 100644 index b331fdb8..00000000 --- a/app/vendor/twig/twig/doc/tags/sandbox.rst +++ /dev/null @@ -1,30 +0,0 @@ -``sandbox`` -=========== - -The ``sandbox`` tag can be used to enable the sandboxing mode for an included -template, when sandboxing is not enabled globally for the Twig environment: - -.. code-block:: twig - - {% sandbox %} - {% include 'user.html' %} - {% endsandbox %} - -.. warning:: - - The ``sandbox`` tag is only available when the sandbox extension is - enabled (see the :doc:`Twig for Developers<../api>` chapter). - -.. note:: - - The ``sandbox`` tag can only be used to sandbox an include tag and it - cannot be used to sandbox a section of a template. The following example - won't work: - - .. code-block:: twig - - {% sandbox %} - {% for i in 1..2 %} - {{ i }} - {% endfor %} - {% endsandbox %} diff --git a/app/vendor/twig/twig/doc/tags/set.rst b/app/vendor/twig/twig/doc/tags/set.rst deleted file mode 100644 index 7a3a784f..00000000 --- a/app/vendor/twig/twig/doc/tags/set.rst +++ /dev/null @@ -1,78 +0,0 @@ -``set`` -======= - -Inside code blocks you can also assign values to variables. Assignments use -the ``set`` tag and can have multiple targets. - -Here is how you can assign the ``bar`` value to the ``foo`` variable: - -.. code-block:: twig - - {% set foo = 'bar' %} - -After the ``set`` call, the ``foo`` variable is available in the template like -any other ones: - -.. code-block:: twig - - {# displays bar #} - {{ foo }} - -The assigned value can be any valid :ref:`Twig expression -`: - -.. code-block:: twig - - {% set foo = [1, 2] %} - {% set foo = {'foo': 'bar'} %} - {% set foo = 'foo' ~ 'bar' %} - -Several variables can be assigned in one block: - -.. code-block:: twig - - {% set foo, bar = 'foo', 'bar' %} - - {# is equivalent to #} - - {% set foo = 'foo' %} - {% set bar = 'bar' %} - -The ``set`` tag can also be used to 'capture' chunks of text: - -.. code-block:: html+twig - - {% set foo %} - - {% endset %} - -.. caution:: - - If you enable automatic output escaping, Twig will only consider the - content to be safe when capturing chunks of text. - -.. note:: - - Note that loops are scoped in Twig; therefore a variable declared inside a - ``for`` loop is not accessible outside the loop itself: - - .. code-block:: twig - - {% for item in list %} - {% set foo = item %} - {% endfor %} - - {# foo is NOT available #} - - If you want to access the variable, just declare it before the loop: - - .. code-block:: twig - - {% set foo = "" %} - {% for item in list %} - {% set foo = item %} - {% endfor %} - - {# foo is available #} diff --git a/app/vendor/twig/twig/doc/tags/use.rst b/app/vendor/twig/twig/doc/tags/use.rst deleted file mode 100644 index 2aca6a01..00000000 --- a/app/vendor/twig/twig/doc/tags/use.rst +++ /dev/null @@ -1,117 +0,0 @@ -``use`` -======= - -.. note:: - - Horizontal reuse is an advanced Twig feature that is hardly ever needed in - regular templates. It is mainly used by projects that need to make - template blocks reusable without using inheritance. - -Template inheritance is one of the most powerful features of Twig but it is -limited to single inheritance; a template can only extend one other template. -This limitation makes template inheritance simple to understand and easy to -debug: - -.. code-block:: twig - - {% extends "base.html" %} - - {% block title %}{% endblock %} - {% block content %}{% endblock %} - -Horizontal reuse is a way to achieve the same goal as multiple inheritance, -but without the associated complexity: - -.. code-block:: twig - - {% extends "base.html" %} - - {% use "blocks.html" %} - - {% block title %}{% endblock %} - {% block content %}{% endblock %} - -The ``use`` statement tells Twig to import the blocks defined in -``blocks.html`` into the current template (it's like macros, but for blocks): - -.. code-block:: twig - - {# blocks.html #} - - {% block sidebar %}{% endblock %} - -In this example, the ``use`` statement imports the ``sidebar`` block into the -main template. The code is mostly equivalent to the following one (the -imported blocks are not outputted automatically): - -.. code-block:: twig - - {% extends "base.html" %} - - {% block sidebar %}{% endblock %} - {% block title %}{% endblock %} - {% block content %}{% endblock %} - -.. note:: - - The ``use`` tag only imports a template if it does not extend another - template, if it does not define macros, and if the body is empty. But it - can *use* other templates. - -.. note:: - - Because ``use`` statements are resolved independently of the context - passed to the template, the template reference cannot be an expression. - -The main template can also override any imported block. If the template -already defines the ``sidebar`` block, then the one defined in ``blocks.html`` -is ignored. To avoid name conflicts, you can rename imported blocks: - -.. code-block:: twig - - {% extends "base.html" %} - - {% use "blocks.html" with sidebar as base_sidebar, title as base_title %} - - {% block sidebar %}{% endblock %} - {% block title %}{% endblock %} - {% block content %}{% endblock %} - -The ``parent()`` function automatically determines the correct inheritance -tree, so it can be used when overriding a block defined in an imported -template: - -.. code-block:: twig - - {% extends "base.html" %} - - {% use "blocks.html" %} - - {% block sidebar %} - {{ parent() }} - {% endblock %} - - {% block title %}{% endblock %} - {% block content %}{% endblock %} - -In this example, ``parent()`` will correctly call the ``sidebar`` block from -the ``blocks.html`` template. - -.. tip:: - - Renaming allows you to simulate inheritance by calling the "parent" block: - - .. code-block:: twig - - {% extends "base.html" %} - - {% use "blocks.html" with sidebar as parent_sidebar %} - - {% block sidebar %} - {{ block('parent_sidebar') }} - {% endblock %} - -.. note:: - - You can use as many ``use`` statements as you want in any given template. - If two imported templates define the same block, the latest one wins. diff --git a/app/vendor/twig/twig/doc/tags/verbatim.rst b/app/vendor/twig/twig/doc/tags/verbatim.rst deleted file mode 100644 index 3d7115a6..00000000 --- a/app/vendor/twig/twig/doc/tags/verbatim.rst +++ /dev/null @@ -1,16 +0,0 @@ -``verbatim`` -============ - -The ``verbatim`` tag marks sections as being raw text that should not be -parsed. For example to put Twig syntax as example into a template you can use -this snippet: - -.. code-block:: html+twig - - {% verbatim %} -
      - {% for item in seq %} -
    • {{ item }}
    • - {% endfor %} -
    - {% endverbatim %} diff --git a/app/vendor/twig/twig/doc/tags/with.rst b/app/vendor/twig/twig/doc/tags/with.rst deleted file mode 100644 index 107432f6..00000000 --- a/app/vendor/twig/twig/doc/tags/with.rst +++ /dev/null @@ -1,41 +0,0 @@ -``with`` -======== - -Use the ``with`` tag to create a new inner scope. Variables set within this -scope are not visible outside of the scope: - -.. code-block:: twig - - {% with %} - {% set foo = 42 %} - {{ foo }} {# foo is 42 here #} - {% endwith %} - foo is not visible here any longer - -Instead of defining variables at the beginning of the scope, you can pass a -hash of variables you want to define in the ``with`` tag; the previous example -is equivalent to the following one: - -.. code-block:: twig - - {% with { foo: 42 } %} - {{ foo }} {# foo is 42 here #} - {% endwith %} - foo is not visible here any longer - - {# it works with any expression that resolves to a hash #} - {% set vars = { foo: 42 } %} - {% with vars %} - ... - {% endwith %} - -By default, the inner scope has access to the outer scope context; you can -disable this behavior by appending the ``only`` keyword: - -.. code-block:: twig - - {% set bar = 'bar' %} - {% with { foo: 42 } only %} - {# only foo is defined #} - {# bar is not defined #} - {% endwith %} diff --git a/app/vendor/twig/twig/doc/templates.rst b/app/vendor/twig/twig/doc/templates.rst deleted file mode 100644 index 5311ad6a..00000000 --- a/app/vendor/twig/twig/doc/templates.rst +++ /dev/null @@ -1,859 +0,0 @@ -Twig for Template Designers -=========================== - -This document describes the syntax and semantics of the template engine and -will be most useful as reference to those creating Twig templates. - -Synopsis --------- - -A template is a regular text file. It can generate any text-based format (HTML, -XML, CSV, LaTeX, etc.). It doesn't have a specific extension, ``.html`` or -``.xml`` are just fine. - -A template contains **variables** or **expressions**, which get replaced with -values when the template is evaluated, and **tags**, which control the -template's logic. - -Below is a minimal template that illustrates a few basics. We will cover further -details later on: - -.. code-block:: html+twig - - - - - My Webpage - - -
    - -

    My Webpage

    - {{ a_variable }} - - - -There are two kinds of delimiters: ``{% ... %}`` and ``{{ ... }}``. The first -one is used to execute statements such as for-loops, the latter outputs the -result of an expression. - -IDEs Integration ----------------- - -Many IDEs support syntax highlighting and auto-completion for Twig: - -* *Textmate* via the `Twig bundle`_ -* *Vim* via the `Jinja syntax plugin`_ or the `vim-twig plugin`_ -* *Netbeans* via the `Twig syntax plugin`_ (until 7.1, native as of 7.2) -* *PhpStorm* (native as of 2.1) -* *Eclipse* via the `Twig plugin`_ -* *Sublime Text* via the `Twig bundle`_ -* *GtkSourceView* via the `Twig language definition`_ (used by gedit and other projects) -* *Coda* and *SubEthaEdit* via the `Twig syntax mode`_ -* *Coda 2* via the `other Twig syntax mode`_ -* *Komodo* and *Komodo Edit* via the Twig highlight/syntax check mode -* *Notepad++* via the `Notepad++ Twig Highlighter`_ -* *Emacs* via `web-mode.el`_ -* *Atom* via the `PHP-twig for atom`_ -* *Visual Studio Code* via the `Twig pack`_ - -Also, `TwigFiddle`_ is an online service that allows you to execute Twig templates -from a browser; it supports all versions of Twig. - -Variables ---------- - -The application passes variables to the templates for manipulation in the -template. Variables may have attributes or elements you can access, too. The -visual representation of a variable depends heavily on the application providing -it. - -Use a dot (``.``) to access attributes of a variable (methods or properties of a -PHP object, or items of a PHP array): - -.. code-block:: twig - - {{ foo.bar }} - -.. note:: - - It's important to know that the curly braces are *not* part of the - variable but the print statement. When accessing variables inside tags, - don't put the braces around them. - -.. sidebar:: Implementation - - For convenience's sake ``foo.bar`` does the following things on the PHP - layer: - - * check if ``foo`` is an array and ``bar`` a valid element; - * if not, and if ``foo`` is an object, check that ``bar`` is a valid property; - * if not, and if ``foo`` is an object, check that ``bar`` is a valid method - (even if ``bar`` is the constructor - use ``__construct()`` instead); - * if not, and if ``foo`` is an object, check that ``getBar`` is a valid method; - * if not, and if ``foo`` is an object, check that ``isBar`` is a valid method; - * if not, and if ``foo`` is an object, check that ``hasBar`` is a valid method; - * if not, return a ``null`` value. - - Twig also supports a specific syntax for accessing items on PHP arrays, - ``foo['bar']``: - - * check if ``foo`` is an array and ``bar`` a valid element; - * if not, return a ``null`` value. - -If a variable or attribute does not exist, you will receive a ``null`` value -when the ``strict_variables`` option is set to ``false``; alternatively, if ``strict_variables`` -is set, Twig will throw an error (see :ref:`environment options`). - -.. note:: - - If you want to access a dynamic attribute of a variable, use the - :doc:`attribute` function instead. - - The ``attribute`` function is also useful when the attribute contains - special characters (like ``-`` that would be interpreted as the minus - operator): - - .. code-block:: twig - - {# equivalent to the non-working foo.data-foo #} - {{ attribute(foo, 'data-foo') }} - -Global Variables -~~~~~~~~~~~~~~~~ - -The following variables are always available in templates: - -* ``_self``: references the current template name; -* ``_context``: references the current context; -* ``_charset``: references the current charset. - -Setting Variables -~~~~~~~~~~~~~~~~~ - -You can assign values to variables inside code blocks. Assignments use the -:doc:`set` tag: - -.. code-block:: twig - - {% set foo = 'foo' %} - {% set foo = [1, 2] %} - {% set foo = {'foo': 'bar'} %} - -Filters -------- - -Variables can be modified by **filters**. Filters are separated from the -variable by a pipe symbol (``|``). Multiple filters can be chained. The output -of one filter is applied to the next. - -The following example removes all HTML tags from the ``name`` and title-cases -it: - -.. code-block:: twig - - {{ name|striptags|title }} - -Filters that accept arguments have parentheses around the arguments. This -example joins the elements of a list by commas: - -.. code-block:: twig - - {{ list|join(', ') }} - -To apply a filter on a section of code, wrap it with the -:doc:`apply` tag: - -.. code-block:: twig - - {% apply upper %} - This text becomes uppercase - {% endapply %} - -Go to the :doc:`filters` page to learn more about built-in -filters. - -Functions ---------- - -Functions can be called to generate content. Functions are called by their -name followed by parentheses (``()``) and may have arguments. - -For instance, the ``range`` function returns a list containing an arithmetic -progression of integers: - -.. code-block:: twig - - {% for i in range(0, 3) %} - {{ i }}, - {% endfor %} - -Go to the :doc:`functions` page to learn more about the -built-in functions. - -.. _named-arguments: - -Named Arguments ---------------- - -.. code-block:: twig - - {% for i in range(low=1, high=10, step=2) %} - {{ i }}, - {% endfor %} - -Using named arguments makes your templates more explicit about the meaning of -the values you pass as arguments: - -.. code-block:: twig - - {{ data|convert_encoding('UTF-8', 'iso-2022-jp') }} - - {# versus #} - - {{ data|convert_encoding(from='iso-2022-jp', to='UTF-8') }} - -Named arguments also allow you to skip some arguments for which you don't want -to change the default value: - -.. code-block:: twig - - {# the first argument is the date format, which defaults to the global date format if null is passed #} - {{ "now"|date(null, "Europe/Paris") }} - - {# or skip the format value by using a named argument for the time zone #} - {{ "now"|date(timezone="Europe/Paris") }} - -You can also use both positional and named arguments in one call, in which -case positional arguments must always come before named arguments: - -.. code-block:: twig - - {{ "now"|date('d/m/Y H:i', timezone="Europe/Paris") }} - -.. tip:: - - Each function and filter documentation page has a section where the names - of all arguments are listed when supported. - -Control Structure ------------------ - -A control structure refers to all those things that control the flow of a -program - conditionals (i.e. ``if``/``elseif``/``else``), ``for``-loops, as -well as things like blocks. Control structures appear inside ``{% ... %}`` -blocks. - -For example, to display a list of users provided in a variable called -``users``, use the :doc:`for` tag: - -.. code-block:: html+twig - -

    Members

    -
      - {% for user in users %} -
    • {{ user.username|e }}
    • - {% endfor %} -
    - -The :doc:`if` tag can be used to test an expression: - -.. code-block:: html+twig - - {% if users|length > 0 %} -
      - {% for user in users %} -
    • {{ user.username|e }}
    • - {% endfor %} -
    - {% endif %} - -Go to the :doc:`tags` page to learn more about the built-in tags. - -Comments --------- - -To comment-out part of a line in a template, use the comment syntax ``{# ... -#}``. This is useful for debugging or to add information for other template -designers or yourself: - -.. code-block:: twig - - {# note: disabled template because we no longer use this - {% for user in users %} - ... - {% endfor %} - #} - -Including other Templates -------------------------- - -The :doc:`include` function is useful to include a template -and return the rendered content of that template into the current one: - -.. code-block:: twig - - {{ include('sidebar.html') }} - -By default, included templates have access to the same context as the template -which includes them. This means that any variable defined in the main template -will be available in the included template too: - -.. code-block:: twig - - {% for box in boxes %} - {{ include('render_box.html') }} - {% endfor %} - -The included template ``render_box.html`` is able to access the ``box`` variable. - -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:: twig - - {{ include('sections/articles/sidebar.html') }} - -This behavior depends on the application embedding Twig. - -Template Inheritance --------------------- - -The most powerful part of Twig is template inheritance. Template inheritance -allows you to build a base "skeleton" template that contains all the common -elements of your site and defines **blocks** that child templates can -override. - -It's easier to understand the concept by starting with an example. - -Let's define a base template, ``base.html``, which defines an HTML skeleton -document that might be used for a two-column page: - -.. code-block:: html+twig - - - - - {% block head %} - - {% block title %}{% endblock %} - My Webpage - {% endblock %} - - -
    {% block content %}{% endblock %}
    - - - - -In this example, the :doc:`block` tags define four blocks that -child templates can fill in. All the ``block`` tag does is to tell the -template engine that a child template may override those portions of the -template. - -A child template might look like this: - -.. code-block:: html+twig - - {% extends "base.html" %} - - {% block title %}Index{% endblock %} - {% block head %} - {{ parent() }} - - {% endblock %} - {% block content %} -

    Index

    -

    - Welcome to my awesome homepage. -

    - {% endblock %} - -The :doc:`extends` tag is the key here. It tells the template -engine that this template "extends" another template. When the template system -evaluates this template, first it locates the parent. The extends tag should -be the first tag in the template. - -Note that since the child template doesn't define the ``footer`` block, the -value from the parent template is used instead. - -It's possible to render the contents of the parent block by using the -:doc:`parent` function. This gives back the results of the -parent block: - -.. code-block:: html+twig - - {% block sidebar %} -

    Table Of Contents

    - ... - {{ parent() }} - {% endblock %} - -.. tip:: - - The documentation page for the :doc:`extends` tag describes - more advanced features like block nesting, scope, dynamic inheritance, and - conditional inheritance. - -.. note:: - - Twig also supports multiple inheritance via "horizontal reuse" with the help - of the :doc:`use` tag. - -HTML Escaping -------------- - -When generating HTML from templates, there's always a risk that a variable -will include characters that affect the resulting HTML. There are two -approaches: manually escaping each variable or automatically escaping -everything by default. - -Twig supports both, automatic escaping is enabled by default. - -The automatic escaping strategy can be configured via the -:ref:`autoescape` option and defaults to ``html``. - -Working with Manual Escaping -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -If manual escaping is enabled, it is **your** responsibility to escape variables -if needed. What to escape? Any variable that comes from an untrusted source. - -Escaping works by using the :doc:`escape` or ``e`` filter: - -.. code-block:: twig - - {{ user.username|e }} - -By default, the ``escape`` filter uses the ``html`` strategy, but depending on -the escaping context, you might want to explicitly use an other strategy: - -.. code-block:: twig - - {{ user.username|e('js') }} - {{ user.username|e('css') }} - {{ user.username|e('url') }} - {{ user.username|e('html_attr') }} - -Working with Automatic Escaping -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Whether automatic escaping is enabled or not, you can mark a section of a -template to be escaped or not by using the :doc:`autoescape` -tag: - -.. code-block:: twig - - {% autoescape %} - Everything will be automatically escaped in this block (using the HTML strategy) - {% endautoescape %} - -By default, auto-escaping uses the ``html`` escaping strategy. If you output -variables in other contexts, you need to explicitly escape them with the -appropriate escaping strategy: - -.. code-block:: twig - - {% autoescape 'js' %} - Everything will be automatically escaped in this block (using the JS strategy) - {% endautoescape %} - -Escaping --------- - -It is sometimes desirable or even necessary to have Twig ignore parts it would -otherwise handle as variables or blocks. For example if the default syntax is -used and you want to use ``{{`` as raw string in the template and not start a -variable you have to use a trick. - -The easiest way is to output the variable delimiter (``{{``) by using a variable -expression: - -.. code-block:: twig - - {{ '{{' }} - -For bigger sections it makes sense to mark a block -:doc:`verbatim`. - -Macros ------- - -Macros are comparable with functions in regular programming languages. They are -useful to reuse HTML fragments to not repeat yourself. They are described in the -:doc:`macro` tag documentation. - -.. _twig-expressions: - -Expressions ------------ - -Twig allows expressions everywhere. - -.. note:: - - 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:: twig - - {% set greeting = 'Hello ' %} - {% set name = 'Fabien' %} - - {{ greeting ~ name|lower }} {# Hello fabien #} - - {# use parenthesis to change precedence #} - {{ (greeting ~ name)|lower }} {# hello fabien #} - -Literals -~~~~~~~~ - -The simplest form of expressions are literals. Literals are representations -for PHP types such as strings, numbers, and arrays. The following literals -exist: - -* ``"Hello World"``: Everything between two double or single quotes is a - string. They are useful whenever you need a string in the template (for - example as arguments to function calls, filters or just to extend or include - a template). A string can contain a delimiter if it is preceded by a - backslash (``\``) -- like in ``'It\'s good'``. If the string contains a - backslash (e.g. ``'c:\Program Files'``) escape it by doubling it - (e.g. ``'c:\\Program Files'``). - -* ``42`` / ``42.23``: Integers and floating point numbers are created by - writing the number down. If a dot is present the number is a float, - otherwise an integer. - -* ``["foo", "bar"]``: Arrays are defined by a sequence of expressions - separated by a comma (``,``) and wrapped with squared brackets (``[]``). - -* ``{"foo": "bar"}``: Hashes are defined by a list of keys and values - separated by a comma (``,``) and wrapped with curly braces (``{}``): - - .. code-block:: twig - - {# keys as string #} - { 'foo': 'foo', 'bar': 'bar' } - - {# keys as names (equivalent to the previous hash) #} - { foo: 'foo', bar: 'bar' } - - {# keys as integer #} - { 2: 'foo', 4: 'bar' } - - {# keys can be omitted if it is the same as the variable name #} - { foo } - {# is equivalent to the following #} - { 'foo': foo } - - {# keys as expressions (the expression must be enclosed into parentheses) #} - {% set foo = 'foo' %} - { (foo): 'foo', (1 + 1): 'bar', (foo ~ 'b'): 'baz' } - -* ``true`` / ``false``: ``true`` represents the true value, ``false`` - represents the false value. - -* ``null``: ``null`` represents no specific value. This is the value returned - when a variable does not exist. ``none`` is an alias for ``null``. - -Arrays and hashes can be nested: - -.. code-block:: twig - - {% set foo = [1, {"foo": "bar"}] %} - -.. tip:: - - Using double-quoted or single-quoted strings has no impact on performance - but :ref:`string interpolation ` is only - supported in double-quoted strings. - -Math -~~~~ - -Twig allows you to do math in templates; the following operators are supported: - -* ``+``: Adds two numbers together (the operands are casted to numbers). ``{{ - 1 + 1 }}`` is ``2``. - -* ``-``: Subtracts the second number from the first one. ``{{ 3 - 2 }}`` is - ``1``. - -* ``/``: Divides two numbers. The returned value will be a floating point - number. ``{{ 1 / 2 }}`` is ``{{ 0.5 }}``. - -* ``%``: Calculates the remainder of an integer division. ``{{ 11 % 7 }}`` is - ``4``. - -* ``//``: Divides two numbers and returns the floored integer result. ``{{ 20 - // 7 }}`` is ``2``, ``{{ -20 // 7 }}`` is ``-3`` (this is just syntactic - sugar for the :doc:`round` filter). - -* ``*``: Multiplies the left operand with the right one. ``{{ 2 * 2 }}`` would - return ``4``. - -* ``**``: Raises the left operand to the power of the right operand. ``{{ 2 ** - 3 }}`` would return ``8``. - -.. _template_logic: - -Logic -~~~~~ - -You can combine multiple expressions with the following operators: - -* ``and``: Returns true if the left and the right operands are both true. - -* ``or``: Returns true if the left or the right operand is true. - -* ``not``: Negates a statement. - -* ``(expr)``: Groups an expression. - -.. note:: - - Twig also supports bitwise operators (``b-and``, ``b-xor``, and ``b-or``). - -.. note:: - - Operators are case sensitive. - -Comparisons -~~~~~~~~~~~ - -The following comparison operators are supported in any expression: ``==``, -``!=``, ``<``, ``>``, ``>=``, and ``<=``. - -You can also check if a string ``starts with`` or ``ends with`` another -string: - -.. code-block:: twig - - {% if 'Fabien' starts with 'F' %} - {% endif %} - - {% if 'Fabien' ends with 'n' %} - {% endif %} - -.. note:: - - For complex string comparisons, the ``matches`` operator allows you to use - `regular expressions`_: - - .. code-block:: twig - - {% if phone matches '/^[\\d\\.]+$/' %} - {% endif %} - -Containment Operator -~~~~~~~~~~~~~~~~~~~~ - -The ``in`` operator performs containment test. It returns ``true`` if the left -operand is contained in the right: - -.. code-block:: twig - - {# returns true #} - - {{ 1 in [1, 2, 3] }} - - {{ 'cd' in 'abcde' }} - -.. tip:: - - You can use this filter to perform a containment test on strings, arrays, - or objects implementing the ``Traversable`` interface. - -To perform a negative test, use the ``not in`` operator: - -.. code-block:: twig - - {% if 1 not in [1, 2, 3] %} - - {# is equivalent to #} - {% if not (1 in [1, 2, 3]) %} - -Test Operator -~~~~~~~~~~~~~ - -The ``is`` operator performs tests. Tests can be used to test a variable against -a common expression. The right operand is name of the test: - -.. code-block:: twig - - {# find out if a variable is odd #} - - {{ name is odd }} - -Tests can accept arguments too: - -.. code-block:: twig - - {% if post.status is constant('Post::PUBLISHED') %} - -Tests can be negated by using the ``is not`` operator: - -.. code-block:: twig - - {% if post.status is not constant('Post::PUBLISHED') %} - - {# is equivalent to #} - {% if not (post.status is constant('Post::PUBLISHED')) %} - -Go to the :doc:`tests` page to learn more about the built-in -tests. - -Other Operators -~~~~~~~~~~~~~~~ - -The following operators don't fit into any of the other categories: - -* ``|``: Applies a filter. - -* ``..``: Creates a sequence based on the operand before and after the operator - (this is syntactic sugar for the :doc:`range` function): - - .. code-block:: twig - - {{ 1..5 }} - - {# equivalent to #} - {{ range(1, 5) }} - - Note that you must use parentheses when combining it with the filter operator - due to the :ref:`operator precedence rules `: - - .. code-block:: twig - - (1..5)|join(', ') - -* ``~``: Converts all operands into strings and concatenates them. ``{{ "Hello - " ~ name ~ "!" }}`` would return (assuming ``name`` is ``'John'``) ``Hello - John!``. - -* ``.``, ``[]``: Gets an attribute of a variable. - -* ``?:``: The ternary operator: - - .. code-block:: twig - - {{ foo ? 'yes' : 'no' }} - {{ foo ?: 'no' }} is the same as {{ foo ? foo : 'no' }} - {{ foo ? 'yes' }} is the same as {{ foo ? 'yes' : '' }} - -* ``??``: The null-coalescing operator: - - .. code-block:: twig - - {# returns the value of foo if it is defined and not null, 'no' otherwise #} - {{ foo ?? 'no' }} - -.. _templates-string-interpolation: - -String Interpolation -~~~~~~~~~~~~~~~~~~~~ - -String interpolation (``#{expression}``) allows any valid expression to appear -within a *double-quoted string*. The result of evaluating that expression is -inserted into the string: - -.. code-block:: twig - - {{ "foo #{bar} baz" }} - {{ "foo #{1 + 2} baz" }} - -.. _templates-whitespace-control: - -Whitespace Control ------------------- - -The first newline after a template tag is removed automatically (like in PHP). -Whitespace is not further modified by the template engine, so each whitespace -(spaces, tabs, newlines etc.) is returned unchanged. - -You can also control whitespace on a per tag level. By using the whitespace -control modifiers on your tags, you can trim leading and or trailing whitespace. - -Twig supports two modifiers: - -* *Whitespace trimming* via the ``-`` modifier: Removes all whitespace - (including newlines); - -* *Line whitespace trimming* via the ``~`` modifier: Removes all whitespace - (excluding newlines). Using this modifier on the right disables the default - removal of the first newline inherited from PHP. - -The modifiers can be used on either side of the tags like in ``{%-`` or ``-%}`` -and they consume all whitespace for that side of the tag. It is possible to use -the modifiers on one side of a tag or on both sides: - -.. code-block:: html+twig - - {% set value = 'no spaces' %} - {#- No leading/trailing whitespace -#} - {%- if true -%} - {{- value -}} - {%- endif -%} - {# output 'no spaces' #} - -
  • - {{ value }}
  • - {# outputs '
  • \n no spaces
  • ' #} - -
  • - {{- value }}
  • - {# outputs '
  • no spaces
  • ' #} - -
  • - {{~ value }}
  • - {# outputs '
  • \nno spaces
  • ' #} - -.. tip:: - - In addition to the whitespace modifiers, Twig also has a ``spaceless`` filter - that removes whitespace **between HTML tags**: - - .. code-block:: html+twig - - {% apply spaceless %} -
    - foo bar -
    - {% endapply %} - - {# output will be
    foo bar
    #} - -Extensions ----------- - -Twig can be extended. If you want to create your own extensions, read the -:ref:`Creating an Extension ` chapter. - -.. _`Twig bundle`: https://github.com/Anomareh/PHP-Twig.tmbundle -.. _`Jinja syntax plugin`: http://jinja.pocoo.org/docs/integration/#vim -.. _`vim-twig plugin`: https://github.com/lumiliet/vim-twig -.. _`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 -.. _`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`: https://www.php.net/manual/en/pcre.pattern.php -.. _`PHP-twig for atom`: https://github.com/reesef/php-twig -.. _`TwigFiddle`: https://twigfiddle.com/ -.. _`Twig pack`: https://marketplace.visualstudio.com/items?itemName=bajdzis.vscode-twig-pack diff --git a/app/vendor/twig/twig/doc/tests/constant.rst b/app/vendor/twig/twig/doc/tests/constant.rst deleted file mode 100644 index 448c238b..00000000 --- a/app/vendor/twig/twig/doc/tests/constant.rst +++ /dev/null @@ -1,19 +0,0 @@ -``constant`` -============ - -``constant`` checks if a variable has the exact same value as a constant. You -can use either global constants or class constants: - -.. code-block:: twig - - {% if post.status is constant('Post::PUBLISHED') %} - the status attribute is exactly the same as Post::PUBLISHED - {% endif %} - -You can test constants from object instances as well: - -.. code-block:: twig - - {% if post.status is constant('PUBLISHED', post) %} - the status attribute is exactly the same as Post::PUBLISHED - {% endif %} diff --git a/app/vendor/twig/twig/doc/tests/defined.rst b/app/vendor/twig/twig/doc/tests/defined.rst deleted file mode 100644 index 234a2898..00000000 --- a/app/vendor/twig/twig/doc/tests/defined.rst +++ /dev/null @@ -1,30 +0,0 @@ -``defined`` -=========== - -``defined`` checks if a variable is defined in the current context. This is very -useful if you use the ``strict_variables`` option: - -.. code-block:: twig - - {# defined works with variable names #} - {% if foo is defined %} - ... - {% endif %} - - {# and attributes on variables names #} - {% if foo.bar is defined %} - ... - {% endif %} - - {% if foo['bar'] is defined %} - ... - {% endif %} - -When using the ``defined`` test on an expression that uses variables in some -method calls, be sure that they are all defined first: - -.. code-block:: twig - - {% if var is defined and foo.method(var) is defined %} - ... - {% endif %} diff --git a/app/vendor/twig/twig/doc/tests/divisibleby.rst b/app/vendor/twig/twig/doc/tests/divisibleby.rst deleted file mode 100644 index 8032d349..00000000 --- a/app/vendor/twig/twig/doc/tests/divisibleby.rst +++ /dev/null @@ -1,10 +0,0 @@ -``divisible by`` -================ - -``divisible by`` checks if a variable is divisible by a number: - -.. code-block:: twig - - {% if loop.index is divisible by(3) %} - ... - {% endif %} diff --git a/app/vendor/twig/twig/doc/tests/empty.rst b/app/vendor/twig/twig/doc/tests/empty.rst deleted file mode 100644 index 0233eca4..00000000 --- a/app/vendor/twig/twig/doc/tests/empty.rst +++ /dev/null @@ -1,18 +0,0 @@ -``empty`` -========= - -``empty`` checks if a variable is an empty string, an empty array, an empty -hash, exactly ``false``, or exactly ``null``. - -For objects that implement the ``Countable`` interface, ``empty`` will check the -return value of the ``count()`` method. - -For objects that implement the ``__toString()`` magic method (and not ``Countable``), -it will check if an empty string is returned. - -.. code-block:: twig - - {% if foo is empty %} - ... - {% endif %} - diff --git a/app/vendor/twig/twig/doc/tests/even.rst b/app/vendor/twig/twig/doc/tests/even.rst deleted file mode 100644 index 2de0de2f..00000000 --- a/app/vendor/twig/twig/doc/tests/even.rst +++ /dev/null @@ -1,12 +0,0 @@ -``even`` -======== - -``even`` returns ``true`` if the given number is even: - -.. code-block:: twig - - {{ var is even }} - -.. seealso:: - - :doc:`odd<../tests/odd>` diff --git a/app/vendor/twig/twig/doc/tests/index.rst b/app/vendor/twig/twig/doc/tests/index.rst deleted file mode 100644 index c63208ee..00000000 --- a/app/vendor/twig/twig/doc/tests/index.rst +++ /dev/null @@ -1,15 +0,0 @@ -Tests -===== - -.. toctree:: - :maxdepth: 1 - - constant - defined - divisibleby - empty - even - iterable - null - odd - sameas diff --git a/app/vendor/twig/twig/doc/tests/iterable.rst b/app/vendor/twig/twig/doc/tests/iterable.rst deleted file mode 100644 index 4ebfe9d8..00000000 --- a/app/vendor/twig/twig/doc/tests/iterable.rst +++ /dev/null @@ -1,16 +0,0 @@ -``iterable`` -============ - -``iterable`` checks if a variable is an array or a traversable object: - -.. code-block:: twig - - {# evaluates to true if the foo variable is iterable #} - {% if users is iterable %} - {% for user in users %} - Hello {{ user }}! - {% endfor %} - {% else %} - {# users is probably a string #} - Hello {{ users }}! - {% endif %} diff --git a/app/vendor/twig/twig/doc/tests/null.rst b/app/vendor/twig/twig/doc/tests/null.rst deleted file mode 100644 index 9ed93f6b..00000000 --- a/app/vendor/twig/twig/doc/tests/null.rst +++ /dev/null @@ -1,12 +0,0 @@ -``null`` -======== - -``null`` returns ``true`` if the variable is ``null``: - -.. code-block:: twig - - {{ var is null }} - -.. note:: - - ``none`` is an alias for ``null``. diff --git a/app/vendor/twig/twig/doc/tests/odd.rst b/app/vendor/twig/twig/doc/tests/odd.rst deleted file mode 100644 index 27fe7e4d..00000000 --- a/app/vendor/twig/twig/doc/tests/odd.rst +++ /dev/null @@ -1,12 +0,0 @@ -``odd`` -======= - -``odd`` returns ``true`` if the given number is odd: - -.. code-block:: twig - - {{ var is odd }} - -.. seealso:: - - :doc:`even<../tests/even>` diff --git a/app/vendor/twig/twig/doc/tests/sameas.rst b/app/vendor/twig/twig/doc/tests/sameas.rst deleted file mode 100644 index c0929711..00000000 --- a/app/vendor/twig/twig/doc/tests/sameas.rst +++ /dev/null @@ -1,11 +0,0 @@ -``same as`` -=========== - -``same as`` checks if a variable is the same as another variable. -This is equivalent to ``===`` in PHP: - -.. code-block:: twig - - {% if foo.attribute is same as(false) %} - the foo attribute really is the 'false' PHP value - {% endif %} diff --git a/app/vendor/twig/twig/src/Cache/FilesystemCache.php b/app/vendor/twig/twig/src/Cache/FilesystemCache.php index a9f1f466..e075563a 100644 --- a/app/vendor/twig/twig/src/Cache/FilesystemCache.php +++ b/app/vendor/twig/twig/src/Cache/FilesystemCache.php @@ -31,7 +31,7 @@ public function __construct(string $directory, int $options = 0) public function generateKey(string $name, string $className): string { - $hash = hash('sha256', $className); + $hash = hash(\PHP_VERSION_ID < 80100 ? 'sha256' : 'xxh128', $className); return $this->directory.$hash[0].$hash[1].'/'.$hash.'.php'; } diff --git a/app/vendor/twig/twig/src/Compiler.php b/app/vendor/twig/twig/src/Compiler.php index b3f1eca3..95e1f183 100644 --- a/app/vendor/twig/twig/src/Compiler.php +++ b/app/vendor/twig/twig/src/Compiler.php @@ -209,6 +209,6 @@ public function outdent(int $step = 1) public function getVarName(): string { - return sprintf('__internal_%s', hash('sha256', __METHOD__.$this->varNameSalt++)); + return sprintf('__internal_compile_%d', $this->varNameSalt++); } } diff --git a/app/vendor/twig/twig/src/Environment.php b/app/vendor/twig/twig/src/Environment.php index a48e9b88..7c9c8952 100644 --- a/app/vendor/twig/twig/src/Environment.php +++ b/app/vendor/twig/twig/src/Environment.php @@ -38,11 +38,11 @@ */ class Environment { - public const VERSION = '3.3.3'; - public const VERSION_ID = 30303; + public const VERSION = '3.4.0'; + public const VERSION_ID = 30400; public const MAJOR_VERSION = 3; - public const MINOR_VERSION = 3; - public const RELEASE_VERSION = 3; + public const MINOR_VERSION = 4; + public const RELEASE_VERSION = 0; public const EXTRA_VERSION = ''; private $charset; @@ -228,7 +228,7 @@ public function setCache($cache) { if (\is_string($cache)) { $this->originalCache = $cache; - $this->cache = new FilesystemCache($cache); + $this->cache = new FilesystemCache($cache, $this->autoReload ? FilesystemCache::FORCE_BYTECODE_INVALIDATION : 0); } elseif (false === $cache) { $this->originalCache = $cache; $this->cache = new NullCache(); @@ -260,7 +260,7 @@ public function getTemplateClass(string $name, int $index = null): string { $key = $this->getLoader()->getCacheKey($name).$this->optionsHash; - return $this->templateClassPrefix.hash('sha256', $key).(null === $index ? '' : '___'.$index); + return $this->templateClassPrefix.hash(\PHP_VERSION_ID < 80100 ? 'sha256' : 'xxh128', $key).(null === $index ? '' : '___'.$index); } /** @@ -382,7 +382,7 @@ public function loadTemplate(string $cls, string $name, int $index = null): Temp */ public function createTemplate(string $template, string $name = null): TemplateWrapper { - $hash = hash('sha256', $template, false); + $hash = hash(\PHP_VERSION_ID < 80100 ? 'sha256' : 'xxh128', $template, false); if (null !== $name) { $name = sprintf('%s (string template %s)', $name, $hash); } else { @@ -433,11 +433,20 @@ public function resolveTemplate($names): TemplateWrapper return $this->load($names); } + $count = \count($names); foreach ($names as $name) { - try { - return $this->load($name); - } catch (LoaderError $e) { + if ($name instanceof Template) { + return $name; } + if ($name instanceof TemplateWrapper) { + return $name; + } + + if (1 !== $count && !$this->getLoader()->exists($name)) { + continue; + } + + return $this->load($name); } throw new LoaderError(sprintf('Unable to find one of the following templates: "%s".', implode('", "', $names))); @@ -548,6 +557,13 @@ public function addRuntimeLoader(RuntimeLoaderInterface $loader) $this->runtimeLoaders[] = $loader; } + /** + * @template TExtension of ExtensionInterface + * + * @param class-string $class + * + * @return TExtension + */ public function getExtension(string $class): ExtensionInterface { return $this->extensionSet->getExtension($class); @@ -556,9 +572,11 @@ public function getExtension(string $class): ExtensionInterface /** * Returns the runtime implementation of a Twig element (filter/function/tag/test). * - * @param string $class A runtime class name + * @template TRuntime of object + * + * @param class-string $class A runtime class name * - * @return object The runtime implementation + * @return TRuntime The runtime implementation * * @throws RuntimeError When the template cannot be found */ diff --git a/app/vendor/twig/twig/src/ExpressionParser.php b/app/vendor/twig/twig/src/ExpressionParser.php index 66acddf6..70b6eb05 100644 --- a/app/vendor/twig/twig/src/ExpressionParser.php +++ b/app/vendor/twig/twig/src/ExpressionParser.php @@ -485,7 +485,7 @@ public function parseSubscriptExpression($node) } } } else { - throw new SyntaxError('Expected name or number.', $lineno, $stream->getSourceContext()); + throw new SyntaxError(sprintf('Expected name or number, got value "%s" of type %s.', $token->getValue(), Token::typeToEnglish($token->getType())), $lineno, $stream->getSourceContext()); } if ($node instanceof NameExpression && null !== $this->parser->getImportedSymbol('template', $node->getAttribute('name'))) { diff --git a/app/vendor/twig/twig/src/Extension/CoreExtension.php b/app/vendor/twig/twig/src/Extension/CoreExtension.php index d52a6005..b7798585 100644 --- a/app/vendor/twig/twig/src/Extension/CoreExtension.php +++ b/app/vendor/twig/twig/src/Extension/CoreExtension.php @@ -177,7 +177,7 @@ public function getFilters(): array // 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('format', 'twig_sprintf'), new TwigFilter('replace', 'twig_replace_filter'), new TwigFilter('number_format', 'twig_number_format_filter', ['needs_environment' => true]), new TwigFilter('abs', 'abs'), @@ -193,15 +193,15 @@ public function getFilters(): array new TwigFilter('capitalize', 'twig_capitalize_string_filter', ['needs_environment' => true]), new TwigFilter('upper', 'twig_upper_filter', ['needs_environment' => true]), new TwigFilter('lower', 'twig_lower_filter', ['needs_environment' => true]), - new TwigFilter('striptags', 'strip_tags'), + new TwigFilter('striptags', 'twig_striptags'), new TwigFilter('trim', 'twig_trim_filter'), - new TwigFilter('nl2br', 'nl2br', ['pre_escape' => 'html', 'is_safe' => ['html']]), + new TwigFilter('nl2br', 'twig_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('sort', 'twig_sort_filter', ['needs_environment' => true]), new TwigFilter('merge', 'twig_array_merge'), new TwigFilter('batch', 'twig_array_batch'), new TwigFilter('column', 'twig_array_column'), @@ -443,6 +443,19 @@ function twig_date_modify_filter(Environment $env, $date, $modifier) return $date->modify($modifier); } +/** + * Returns a formatted string. + * + * @param string|null $format + * @param ...$values + * + * @return string + */ +function twig_sprintf($format, ...$values) +{ + return sprintf($format ?? '', ...$values); +} + /** * Converts an input to a \DateTime instance. * @@ -505,7 +518,7 @@ function twig_date_converter(Environment $env, $date = null, $timezone = null) /** * Replaces strings within a string. * - * @param string $str String to replace in + * @param string|null $str String to replace in * @param array|\Traversable $from Replace values * * @return string @@ -516,20 +529,22 @@ function twig_replace_filter($str, $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, twig_to_array($from)); + return strtr($str ?? '', twig_to_array($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 + * @param int|float|string|null $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') { + $value = (float) $value; + if ('common' === $method) { return round($value, $precision); } @@ -545,7 +560,7 @@ function twig_round($value, $precision = 0, $method = 'common') * 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 + * 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 @@ -576,7 +591,7 @@ function twig_number_format_filter(Environment $env, $number, $decimal = null, $ /** * 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 + * @param string|array|null $url A URL or an array of query parameters * * @return string The URL encoded value */ @@ -586,7 +601,7 @@ function twig_urlencode_filter($url) return http_build_query($url, '', '&', \PHP_QUERY_RFC3986); } - return rawurlencode($url); + return rawurlencode($url ?? ''); } /** @@ -648,9 +663,7 @@ function twig_slice(Environment $env, $item, $start, $length = null, $preserveKe return \array_slice($item, $start, $length, $preserveKeys); } - $item = (string) $item; - - return mb_substr($item, $start, $length, $env->getCharset()); + return (string) mb_substr((string) $item, $start, $length, $env->getCharset()); } /** @@ -739,14 +752,16 @@ function twig_join_filter($value, $glue = '', $and = null) * {{ "aabbcc"|split('', 2) }} * {# returns [aa, bb, cc] #} * - * @param string $value A string - * @param string $delimiter The delimiter - * @param int $limit The limit + * @param string|null $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) { + $value = $value ?? ''; + if (\strlen($delimiter) > 0) { return null === $limit ? explode($delimiter, $value) : explode($delimiter, $value, $limit); } @@ -831,8 +846,8 @@ function twig_get_array_keys_filter($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 + * @param array|\Traversable|string|null $item An array, a \Traversable instance, or a string + * @param bool $preserveKeys Whether to preserve key or not * * @return mixed The reversed input */ @@ -851,10 +866,10 @@ function twig_reverse_filter(Environment $env, $item, $preserveKeys = false) $charset = $env->getCharset(); if ('UTF-8' !== $charset) { - $item = twig_convert_encoding($string, 'UTF-8', $charset); + $string = twig_convert_encoding($string, 'UTF-8', $charset); } - preg_match_all('/./us', $item, $matches); + preg_match_all('/./us', $string, $matches); $string = implode('', array_reverse($matches[0])); @@ -872,7 +887,7 @@ function twig_reverse_filter(Environment $env, $item, $preserveKeys = false) * * @return array */ -function twig_sort_filter($array, $arrow = null) +function twig_sort_filter(Environment $env, $array, $arrow = null) { if ($array instanceof \Traversable) { $array = iterator_to_array($array); @@ -881,6 +896,8 @@ function twig_sort_filter($array, $arrow = null) } if (null !== $arrow) { + twig_check_arrow_in_sandbox($env, $arrow, 'sort', 'filter'); + uasort($array, $arrow); } else { asort($array); @@ -1001,6 +1018,10 @@ function twig_compare($a, $b) /** * Returns a trimmed string. * + * @param string|null $string + * @param string|null $characterMask + * @param string $side + * * @return string * * @throws RuntimeError When an invalid trimming side is used (not a string or not 'left', 'right', or 'both') @@ -1013,33 +1034,54 @@ function twig_trim_filter($string, $characterMask = null, $side = 'both') switch ($side) { case 'both': - return trim($string, $characterMask); + return trim($string ?? '', $characterMask); case 'left': - return ltrim($string, $characterMask); + return ltrim($string ?? '', $characterMask); case 'right': - return rtrim($string, $characterMask); + return rtrim($string ?? '', $characterMask); default: throw new RuntimeError('Trimming side must be "left", "right" or "both".'); } } +/** + * Inserts HTML line breaks before all newlines in a string. + * + * @param string|null $string + * + * @return string + */ +function twig_nl2br($string) +{ + return nl2br($string ?? ''); +} + /** * Removes whitespaces between HTML tags. * + * @param string|null $string + * * @return string */ function twig_spaceless($content) { - return trim(preg_replace('/>\s+<', $content)); + return trim(preg_replace('/>\s+<', $content ?? '')); } +/** + * @param string|null $string + * @param string $to + * @param string $from + * + * @return string + */ function twig_convert_encoding($string, $to, $from) { if (!\function_exists('iconv')) { throw new RuntimeError('Unable to convert encoding: required function iconv() does not exist. You should install ext-iconv or symfony/polyfill-iconv.'); } - return iconv($from, $to, $string); + return iconv($from, $to, $string ?? ''); } /** @@ -1077,47 +1119,60 @@ function twig_length_filter(Environment $env, $thing) /** * Converts a string to uppercase. * - * @param string $string A string + * @param string|null $string A string * * @return string The uppercased string */ function twig_upper_filter(Environment $env, $string) { - return mb_strtoupper($string, $env->getCharset()); + return mb_strtoupper($string ?? '', $env->getCharset()); } /** * Converts a string to lowercase. * - * @param string $string A string + * @param string|null $string A string * * @return string The lowercased string */ function twig_lower_filter(Environment $env, $string) { - return mb_strtolower($string, $env->getCharset()); + return mb_strtolower($string ?? '', $env->getCharset()); +} + +/** + * Strips HTML and PHP tags from a string. + * + * @param string|null $string + * @param string[]|string|null $string + * + * @return string + */ +function twig_striptags($string, $allowable_tags = null) +{ + return strip_tags($string ?? '', $allowable_tags); } /** * Returns a titlecased string. * - * @param string $string A string + * @param string|null $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 mb_convert_case($string ?? '', \MB_CASE_TITLE, $charset); } - return ucwords(strtolower($string)); + return ucwords(strtolower($string ?? '')); } /** * Returns a capitalized string. * - * @param string $string A string + * @param string|null $string A string * * @return string The capitalized string */ @@ -1125,7 +1180,7 @@ function twig_capitalize_string_filter(Environment $env, $string) { $charset = $env->getCharset(); - return mb_strtoupper(mb_substr($string, 0, 1, $charset), $charset).mb_strtolower(mb_substr($string, 1, null, $charset), $charset); + return mb_strtoupper(mb_substr($string ?? '', 0, 1, $charset), $charset).mb_strtolower(mb_substr($string ?? '', 1, null, $charset), $charset); } /** @@ -1304,6 +1359,10 @@ function twig_source(Environment $env, $name, $ignoreMissing = false) function twig_constant($constant, $object = null) { if (null !== $object) { + if ('class' === $constant) { + return \get_class($object); + } + $constant = \get_class($object).'::'.$constant; } @@ -1321,6 +1380,10 @@ function twig_constant($constant, $object = null) function twig_constant_is_defined($constant, $object = null) { if (null !== $object) { + if ('class' === $constant) { + return true; + } + $constant = \get_class($object).'::'.$constant; } @@ -1586,9 +1649,7 @@ function twig_array_filter(Environment $env, $array, $arrow) throw new RuntimeError(sprintf('The "filter" filter expects an array or "Traversable", got "%s".', \is_object($array) ? \get_class($array) : \gettype($array))); } - if (!$arrow instanceof Closure && $env->hasExtension('\Twig\Extension\SandboxExtension') && $env->getExtension('\Twig\Extension\SandboxExtension')->isSandboxed()) { - throw new RuntimeError('The callable passed to "filter" filter must be a Closure in sandbox mode.'); - } + twig_check_arrow_in_sandbox($env, $arrow, 'filter', 'filter'); if (\is_array($array)) { return array_filter($array, $arrow, \ARRAY_FILTER_USE_BOTH); @@ -1600,9 +1661,7 @@ function twig_array_filter(Environment $env, $array, $arrow) function twig_array_map(Environment $env, $array, $arrow) { - if (!$arrow instanceof Closure && $env->hasExtension('\Twig\Extension\SandboxExtension') && $env->getExtension('\Twig\Extension\SandboxExtension')->isSandboxed()) { - throw new RuntimeError('The callable passed to the "map" filter must be a Closure in sandbox mode.'); - } + twig_check_arrow_in_sandbox($env, $arrow, 'map', 'filter'); $r = []; foreach ($array as $k => $v) { @@ -1614,9 +1673,7 @@ function twig_array_map(Environment $env, $array, $arrow) function twig_array_reduce(Environment $env, $array, $arrow, $initial = null) { - if (!$arrow instanceof Closure && $env->hasExtension('\Twig\Extension\SandboxExtension') && $env->getExtension('\Twig\Extension\SandboxExtension')->isSandboxed()) { - throw new RuntimeError('The callable passed to the "reduce" filter must be a Closure in sandbox mode.'); - } + twig_check_arrow_in_sandbox($env, $arrow, 'reduce', 'filter'); if (!\is_array($array)) { if (!$array instanceof \Traversable) { @@ -1628,4 +1685,11 @@ function twig_array_reduce(Environment $env, $array, $arrow, $initial = null) return array_reduce($array, $arrow, $initial); } + +function twig_check_arrow_in_sandbox(Environment $env, $arrow, $thing, $type) +{ + if (!$arrow instanceof Closure && $env->hasExtension('\Twig\Extension\SandboxExtension') && $env->getExtension('\Twig\Extension\SandboxExtension')->isSandboxed()) { + throw new RuntimeError(sprintf('The callable passed to the "%s" %s must be a Closure in sandbox mode.', $thing, $type)); + } +} } diff --git a/app/vendor/twig/twig/src/Extension/EscaperExtension.php b/app/vendor/twig/twig/src/Extension/EscaperExtension.php index 72795da3..9d2251dc 100644 --- a/app/vendor/twig/twig/src/Extension/EscaperExtension.php +++ b/app/vendor/twig/twig/src/Extension/EscaperExtension.php @@ -387,13 +387,8 @@ function twig_escape_filter(Environment $env, $string, $strategy = 'html', $char return rawurlencode($string); default: - static $escapers; - - if (null === $escapers) { - $escapers = $env->getExtension(EscaperExtension::class)->getEscapers(); - } - - if (isset($escapers[$strategy])) { + $escapers = $env->getExtension(EscaperExtension::class)->getEscapers(); + if (array_key_exists($strategy, $escapers)) { return $escapers[$strategy]($env, $string, $charset); } diff --git a/app/vendor/twig/twig/src/Extension/SandboxExtension.php b/app/vendor/twig/twig/src/Extension/SandboxExtension.php index 0a28cabf..c861159b 100644 --- a/app/vendor/twig/twig/src/Extension/SandboxExtension.php +++ b/app/vendor/twig/twig/src/Extension/SandboxExtension.php @@ -91,11 +91,11 @@ public function checkMethodAllowed($obj, $method, int $lineno = -1, Source $sour } } - public function checkPropertyAllowed($obj, $method, int $lineno = -1, Source $source = null): void + public function checkPropertyAllowed($obj, $property, int $lineno = -1, Source $source = null): void { if ($this->isSandboxed()) { try { - $this->policy->checkPropertyAllowed($obj, $method); + $this->policy->checkPropertyAllowed($obj, $property); } catch (SecurityNotAllowedPropertyError $e) { $e->setSourceContext($source); $e->setTemplateLine($lineno); diff --git a/app/vendor/twig/twig/src/Node/Expression/CallExpression.php b/app/vendor/twig/twig/src/Node/Expression/CallExpression.php index fdf92a8e..da72843a 100644 --- a/app/vendor/twig/twig/src/Node/Expression/CallExpression.php +++ b/app/vendor/twig/twig/src/Node/Expression/CallExpression.php @@ -24,19 +24,20 @@ protected function compileCallable(Compiler $compiler) { $callable = $this->getAttribute('callable'); - $closingParenthesis = false; - $isArray = false; 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()) { + [$r, $callable] = $this->reflectCallable($callable); + + if (\is_string($callable)) { + $compiler->raw($callable); + } elseif (\is_array($callable) && \is_string($callable[0])) { + if (!$r instanceof \ReflectionMethod || $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) { + } elseif (\is_array($callable) && $callable[0] instanceof ExtensionInterface) { $class = \get_class($callable[0]); if (!$compiler->getEnvironment()->hasExtension($class)) { // Compile a non-optimized call to trigger a \Twig\Error\RuntimeError, which cannot be a compile-time error @@ -47,17 +48,11 @@ protected function compileCallable(Compiler $compiler) $compiler->raw(sprintf('->%s', $callable[1])); } else { - $closingParenthesis = true; - $isArray = true; - $compiler->raw(sprintf('call_user_func_array($this->env->get%s(\'%s\')->getCallable(), ', ucfirst($this->getAttribute('type')), $this->getAttribute('name'))); + $compiler->raw(sprintf('$this->env->get%s(\'%s\')->getCallable()', ucfirst($this->getAttribute('type')), $this->getAttribute('name'))); } } - $this->compileArguments($compiler, $isArray); - - if ($closingParenthesis) { - $compiler->raw(')'); - } + $this->compileArguments($compiler); } protected function compileArguments(Compiler $compiler, $isArray = false): void @@ -244,10 +239,7 @@ protected function normalizeName(string $name): string private function getCallableParameters($callable, bool $isVariadic): array { - list($r) = $this->reflectCallable($callable); - if (null === $r) { - return [[], false]; - } + [$r, , $callableName] = $this->reflectCallable($callable); $parameters = $r->getParameters(); if ($this->hasNode('node')) { @@ -274,11 +266,6 @@ private function getCallableParameters($callable, bool $isVariadic): array array_pop($parameters); $isPhpVariadic = true; } 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'))); } } @@ -292,29 +279,32 @@ private function reflectCallable($callable) return $this->reflector; } - if (\is_array($callable)) { - if (!method_exists($callable[0], $callable[1])) { - // __call() - return [null, []]; - } + if (\is_string($callable) && false !== $pos = strpos($callable, '::')) { + $callable = [substr($callable, 0, $pos), substr($callable, 2 + $pos)]; + } + + if (\is_array($callable) && method_exists($callable[0], $callable[1])) { $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]; + + return $this->reflector = [$r, $callable, $r->class.'::'.$r->name]; + } + + $r = new \ReflectionFunction(\Closure::fromCallable($callable)); + + if (false !== strpos($r->name, '{closure}')) { + return $this->reflector = [$r, $callable, 'Closure']; + } + + if ($object = $r->getClosureThis()) { + $callable = [$object, $r->name]; + $callableName = (\function_exists('get_debug_type') ? get_debug_type($object) : \get_class($object)).'::'.$r->name; + } elseif ($class = $r->getClosureScopeClass()) { + $callable = [$class, $r->name]; + $callableName = $class.'::'.$r->name; } else { - $r = new \ReflectionFunction($callable); + $callable = $callableName = $r->name; } - return $this->reflector = [$r, $callable]; + return $this->reflector = [$r, $callable, $callableName]; } } diff --git a/app/vendor/twig/twig/src/Parser.php b/app/vendor/twig/twig/src/Parser.php index 6103695e..4428208f 100644 --- a/app/vendor/twig/twig/src/Parser.php +++ b/app/vendor/twig/twig/src/Parser.php @@ -52,13 +52,13 @@ public function __construct(Environment $env) public function getVarName(): string { - return sprintf('__internal_%s', hash('sha256', __METHOD__.$this->stream->getSourceContext()->getCode().$this->varNameSalt++)); + return sprintf('__internal_parse_%d', $this->varNameSalt++); } public function parse(TokenStream $stream, $test = null, bool $dropNeedle = false): ModuleNode { $vars = get_object_vars($this); - unset($vars['stack'], $vars['env'], $vars['handlers'], $vars['visitors'], $vars['expressionParser'], $vars['reservedMacroNames']); + unset($vars['stack'], $vars['env'], $vars['handlers'], $vars['visitors'], $vars['expressionParser'], $vars['reservedMacroNames'], $vars['varNameSalt']); $this->stack[] = $vars; // node visitors @@ -78,7 +78,6 @@ public function parse(TokenStream $stream, $test = null, bool $dropNeedle = fals $this->blockStack = []; $this->importedSymbols = [[]]; $this->embeddedTemplates = []; - $this->varNameSalt = 0; try { $body = $this->subparse($test, $dropNeedle); diff --git a/app/vendor/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php b/app/vendor/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php index bd23b208..91abee80 100644 --- a/app/vendor/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php +++ b/app/vendor/twig/twig/src/Profiler/NodeVisitor/ProfilerNodeVisitor.php @@ -28,10 +28,12 @@ final class ProfilerNodeVisitor implements NodeVisitorInterface { private $extensionName; + private $varName; public function __construct(string $extensionName) { $this->extensionName = $extensionName; + $this->varName = sprintf('__internal_%s', hash(\PHP_VERSION_ID < 80100 ? 'sha256' : 'xxh128', $extensionName)); } public function enterNode(Node $node, Environment $env): Node @@ -42,33 +44,25 @@ public function enterNode(Node $node, Environment $env): Node public function leaveNode(Node $node, Environment $env): ?Node { 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')])); + $node->setNode('display_start', new Node([new EnterProfileNode($this->extensionName, Profile::TEMPLATE, $node->getTemplateName(), $this->varName), $node->getNode('display_start')])); + $node->setNode('display_end', new Node([new LeaveProfileNode($this->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), + new EnterProfileNode($this->extensionName, Profile::BLOCK, $node->getAttribute('name'), $this->varName), $node->getNode('body'), - new LeaveProfileNode($varName), + new LeaveProfileNode($this->varName), ])); } elseif ($node instanceof MacroNode) { - $varName = $this->getVarName(); $node->setNode('body', new BodyNode([ - new EnterProfileNode($this->extensionName, Profile::MACRO, $node->getAttribute('name'), $varName), + new EnterProfileNode($this->extensionName, Profile::MACRO, $node->getAttribute('name'), $this->varName), $node->getNode('body'), - new LeaveProfileNode($varName), + new LeaveProfileNode($this->varName), ])); } return $node; } - private function getVarName(): string - { - return sprintf('__internal_%s', hash('sha256', $this->extensionName)); - } - public function getPriority(): int { return 0; diff --git a/app/vendor/twig/twig/src/Sandbox/SecurityPolicyInterface.php b/app/vendor/twig/twig/src/Sandbox/SecurityPolicyInterface.php index 4cb479d5..36471c54 100644 --- a/app/vendor/twig/twig/src/Sandbox/SecurityPolicyInterface.php +++ b/app/vendor/twig/twig/src/Sandbox/SecurityPolicyInterface.php @@ -19,17 +19,27 @@ interface SecurityPolicyInterface { /** + * @param string[] $tags + * @param string[] $filters + * @param string[] $functions + * * @throws SecurityError */ public function checkSecurity($tags, $filters, $functions): void; /** + * @param object $obj + * @param string $method + * * @throws SecurityNotAllowedMethodError */ public function checkMethodAllowed($obj, $method): void; /** + * @param object $obj + * @param string $property + * * @throws SecurityNotAllowedPropertyError */ - public function checkPropertyAllowed($obj, $method): void; + public function checkPropertyAllowed($obj, $property): void; } diff --git a/app/vendor/twig/twig/src/Test/IntegrationTestCase.php b/app/vendor/twig/twig/src/Test/IntegrationTestCase.php index 7d7d5909..307302bb 100644 --- a/app/vendor/twig/twig/src/Test/IntegrationTestCase.php +++ b/app/vendor/twig/twig/src/Test/IntegrationTestCase.php @@ -186,7 +186,7 @@ protected function doIntegrationTest($file, $message, $condition, $templates, $e // avoid using the same PHP class name for different cases $p = new \ReflectionProperty($twig, 'templateClassPrefix'); $p->setAccessible(true); - $p->setValue($twig, '__TwigTemplate_'.hash('sha256', uniqid(mt_rand(), true), false).'_'); + $p->setValue($twig, '__TwigTemplate_'.hash(\PHP_VERSION_ID < 80100 ? 'sha256' : 'xxh128', uniqid(mt_rand(), true), false).'_'); $deprecations = []; try {