From 35a72291586c5ecdb18c77bdcafe031802b038a3 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Wed, 16 Mar 2022 16:59:12 +0900 Subject: [PATCH] composer vendor update and .env file fixes, remove debug echo No more echo for any debug logging Update .env file sample data --- www/composer.lock | 30 +-- www/configs/.env.example | 8 +- www/configs/config.db.php | 8 +- www/includes/admin_footer.php | 5 +- www/vendor/composer/autoload_classmap.php | 29 +-- www/vendor/composer/autoload_static.php | 29 +-- www/vendor/composer/installed.json | 34 ++-- www/vendor/composer/installed.php | 16 +- www/vendor/phpunit/phpunit/ChangeLog-9.5.md | 9 + www/vendor/phpunit/phpunit/composer.json | 2 +- .../src/Framework/MockObject/Generator.php | 61 +++++++ .../MockObject/Generator/intersection.tpl | 5 + ...id.tpl => mocked_method_never_or_void.tpl} | 0 ...d.tpl => proxied_method_never_or_void.tpl} | 0 .../src/Framework/MockObject/Invocation.php | 171 +++++++++++------- .../src/Framework/MockObject/MockMethod.php | 48 ++++- .../phpunit/phpunit/src/Runner/Version.php | 2 +- www/vendor/sebastian/type/ChangeLog.md | 27 +++ www/vendor/sebastian/type/LICENSE | 2 +- www/vendor/sebastian/type/composer.json | 7 +- .../sebastian/type/src/ReflectionMapper.php | 70 +++---- www/vendor/sebastian/type/src/TypeName.php | 30 --- .../type/src/exception/LogicException.php | 14 -- .../type/src/{ => type}/CallableType.php | 6 +- .../type/src/{ => type}/FalseType.php | 11 +- .../type/src/{ => type}/GenericObjectType.php | 5 + .../type/src/type/IntersectionType.php | 115 ++++++++++++ .../type/src/{ => type}/IterableType.php | 5 + .../type/src/{ => type}/MixedType.php | 5 + .../sebastian/type/src/type/NeverType.php | 33 ++++ .../type/src/{ => type}/NullType.php | 15 +- .../type/src/{ => type}/ObjectType.php | 5 + .../type/src/{ => type}/SimpleType.php | 5 + .../type/src/{ => type}/StaticType.php | 5 + .../sebastian/type/src/{ => type}/Type.php | 82 ++++++++- .../type/src/{ => type}/UnionType.php | 15 +- .../type/src/{ => type}/UnknownType.php | 15 +- .../type/src/{ => type}/VoidType.php | 5 + 38 files changed, 646 insertions(+), 288 deletions(-) create mode 100644 www/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/intersection.tpl rename www/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/{mocked_method_void.tpl => mocked_method_never_or_void.tpl} (100%) rename www/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/{proxied_method_void.tpl => proxied_method_never_or_void.tpl} (100%) delete mode 100644 www/vendor/sebastian/type/src/exception/LogicException.php rename www/vendor/sebastian/type/src/{ => type}/CallableType.php (98%) rename www/vendor/sebastian/type/src/{ => type}/FalseType.php (79%) rename www/vendor/sebastian/type/src/{ => type}/GenericObjectType.php (92%) create mode 100644 www/vendor/sebastian/type/src/type/IntersectionType.php rename www/vendor/sebastian/type/src/{ => type}/IterableType.php (96%) rename www/vendor/sebastian/type/src/{ => type}/MixedType.php (90%) create mode 100644 www/vendor/sebastian/type/src/type/NeverType.php rename www/vendor/sebastian/type/src/{ => type}/NullType.php (82%) rename www/vendor/sebastian/type/src/{ => type}/ObjectType.php (95%) rename www/vendor/sebastian/type/src/{ => type}/SimpleType.php (96%) rename www/vendor/sebastian/type/src/{ => type}/StaticType.php (94%) rename www/vendor/sebastian/type/src/{ => type}/Type.php (64%) rename www/vendor/sebastian/type/src/{ => type}/UnionType.php (93%) rename www/vendor/sebastian/type/src/{ => type}/UnknownType.php (82%) rename www/vendor/sebastian/type/src/{ => type}/VoidType.php (89%) diff --git a/www/composer.lock b/www/composer.lock index 9b843aea..19bd17dc 100644 --- a/www/composer.lock +++ b/www/composer.lock @@ -850,16 +850,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.18", + "version": "9.5.19", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "1b5856028273bfd855e60a887278857d872ec67a" + "reference": "35ea4b7f3acabb26f4bb640f8c30866c401da807" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1b5856028273bfd855e60a887278857d872ec67a", - "reference": "1b5856028273bfd855e60a887278857d872ec67a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/35ea4b7f3acabb26f4bb640f8c30866c401da807", + "reference": "35ea4b7f3acabb26f4bb640f8c30866c401da807", "shasum": "" }, "require": { @@ -889,7 +889,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": { @@ -937,7 +937,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.18" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.19" }, "funding": [ { @@ -949,7 +949,7 @@ "type": "github" } ], - "time": "2022-03-08T06:52:28+00:00" + "time": "2022-03-15T09:57:31+00:00" }, { "name": "sebastian/cli-parser", @@ -1808,28 +1808,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": { @@ -1852,7 +1852,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": [ { @@ -1860,7 +1860,7 @@ "type": "github" } ], - "time": "2021-06-15T12:49:02+00:00" + "time": "2022-03-15T09:54:48+00:00" }, { "name": "sebastian/version", diff --git a/www/configs/.env.example b/www/configs/.env.example index 7f0e86df..de44c7c8 100644 --- a/www/configs/.env.example +++ b/www/configs/.env.example @@ -2,7 +2,7 @@ BASE_NAME= G_TITLE= # DB configs -DB_NAME_TEST= -DB_USER_TEST= -DB_PASS_TEST= -DB_HOST_TEST= +DB_NAME.TEST= +DB_USER.TEST= +DB_PASS.TEST= +DB_HOST.TEST= diff --git a/www/configs/config.db.php b/www/configs/config.db.php index 0a5141f3..3c4c06e4 100644 --- a/www/configs/config.db.php +++ b/www/configs/config.db.php @@ -13,10 +13,10 @@ declare(strict_types=1); // please be VERY carefull only to change the right side $DB_CONFIG = [ 'test' => [ - 'db_name' => $_ENV['DB_NAME_TEST'] ?? '', - 'db_user' => $_ENV['DB_USER_TEST'] ?? '', - 'db_pass' => $_ENV['DB_PASS_TEST'] ?? '', - 'db_host' => $_ENV['DB_HOST_TEST'] ?? '', + 'db_name' => $_ENV['DB_NAME.TEST'] ?? '', + 'db_user' => $_ENV['DB_USER.TEST'] ?? '', + 'db_pass' => $_ENV['DB_PASS.TEST'] ?? '', + 'db_host' => $_ENV['DB_HOST.TEST'] ?? '', 'db_port' => 5432, 'db_schema' => 'public', 'db_type' => 'pgsql', diff --git a/www/includes/admin_footer.php b/www/includes/admin_footer.php index c88b5a5f..df6c71bf 100644 --- a/www/includes/admin_footer.php +++ b/www/includes/admin_footer.php @@ -11,8 +11,9 @@ declare(strict_types=1); // print debug messages -echo $login->log->printErrorMsg(); -echo $cms->log->printErrorMsg(); +// remove if no echo output is actually needed +// echo $login->log->printErrorMsg(); +// echo $cms->log->printErrorMsg(); $cms->log->debug('DEBUGEND', '==================================== [END]'); // __END__ diff --git a/www/vendor/composer/autoload_classmap.php b/www/vendor/composer/autoload_classmap.php index 639b2a49..3a39ef35 100644 --- a/www/vendor/composer/autoload_classmap.php +++ b/www/vendor/composer/autoload_classmap.php @@ -652,24 +652,25 @@ return array( 'SebastianBergmann\\Timer\\ResourceUsageFormatter' => $vendorDir . '/phpunit/php-timer/src/ResourceUsageFormatter.php', 'SebastianBergmann\\Timer\\TimeSinceStartOfRequestNotAvailableException' => $vendorDir . '/phpunit/php-timer/src/exceptions/TimeSinceStartOfRequestNotAvailableException.php', 'SebastianBergmann\\Timer\\Timer' => $vendorDir . '/phpunit/php-timer/src/Timer.php', - 'SebastianBergmann\\Type\\CallableType' => $vendorDir . '/sebastian/type/src/CallableType.php', + 'SebastianBergmann\\Type\\CallableType' => $vendorDir . '/sebastian/type/src/type/CallableType.php', 'SebastianBergmann\\Type\\Exception' => $vendorDir . '/sebastian/type/src/exception/Exception.php', - 'SebastianBergmann\\Type\\FalseType' => $vendorDir . '/sebastian/type/src/FalseType.php', - 'SebastianBergmann\\Type\\GenericObjectType' => $vendorDir . '/sebastian/type/src/GenericObjectType.php', - 'SebastianBergmann\\Type\\IterableType' => $vendorDir . '/sebastian/type/src/IterableType.php', - 'SebastianBergmann\\Type\\LogicException' => $vendorDir . '/sebastian/type/src/exception/LogicException.php', - 'SebastianBergmann\\Type\\MixedType' => $vendorDir . '/sebastian/type/src/MixedType.php', - 'SebastianBergmann\\Type\\NullType' => $vendorDir . '/sebastian/type/src/NullType.php', - 'SebastianBergmann\\Type\\ObjectType' => $vendorDir . '/sebastian/type/src/ObjectType.php', + 'SebastianBergmann\\Type\\FalseType' => $vendorDir . '/sebastian/type/src/type/FalseType.php', + 'SebastianBergmann\\Type\\GenericObjectType' => $vendorDir . '/sebastian/type/src/type/GenericObjectType.php', + 'SebastianBergmann\\Type\\IntersectionType' => $vendorDir . '/sebastian/type/src/type/IntersectionType.php', + 'SebastianBergmann\\Type\\IterableType' => $vendorDir . '/sebastian/type/src/type/IterableType.php', + 'SebastianBergmann\\Type\\MixedType' => $vendorDir . '/sebastian/type/src/type/MixedType.php', + 'SebastianBergmann\\Type\\NeverType' => $vendorDir . '/sebastian/type/src/type/NeverType.php', + 'SebastianBergmann\\Type\\NullType' => $vendorDir . '/sebastian/type/src/type/NullType.php', + 'SebastianBergmann\\Type\\ObjectType' => $vendorDir . '/sebastian/type/src/type/ObjectType.php', 'SebastianBergmann\\Type\\ReflectionMapper' => $vendorDir . '/sebastian/type/src/ReflectionMapper.php', 'SebastianBergmann\\Type\\RuntimeException' => $vendorDir . '/sebastian/type/src/exception/RuntimeException.php', - 'SebastianBergmann\\Type\\SimpleType' => $vendorDir . '/sebastian/type/src/SimpleType.php', - 'SebastianBergmann\\Type\\StaticType' => $vendorDir . '/sebastian/type/src/StaticType.php', - 'SebastianBergmann\\Type\\Type' => $vendorDir . '/sebastian/type/src/Type.php', + 'SebastianBergmann\\Type\\SimpleType' => $vendorDir . '/sebastian/type/src/type/SimpleType.php', + 'SebastianBergmann\\Type\\StaticType' => $vendorDir . '/sebastian/type/src/type/StaticType.php', + 'SebastianBergmann\\Type\\Type' => $vendorDir . '/sebastian/type/src/type/Type.php', 'SebastianBergmann\\Type\\TypeName' => $vendorDir . '/sebastian/type/src/TypeName.php', - 'SebastianBergmann\\Type\\UnionType' => $vendorDir . '/sebastian/type/src/UnionType.php', - 'SebastianBergmann\\Type\\UnknownType' => $vendorDir . '/sebastian/type/src/UnknownType.php', - 'SebastianBergmann\\Type\\VoidType' => $vendorDir . '/sebastian/type/src/VoidType.php', + 'SebastianBergmann\\Type\\UnionType' => $vendorDir . '/sebastian/type/src/type/UnionType.php', + 'SebastianBergmann\\Type\\UnknownType' => $vendorDir . '/sebastian/type/src/type/UnknownType.php', + 'SebastianBergmann\\Type\\VoidType' => $vendorDir . '/sebastian/type/src/type/VoidType.php', 'SebastianBergmann\\Version' => $vendorDir . '/sebastian/version/src/Version.php', 'Smarty' => $baseDir . '/lib/Smarty/Smarty.class.php', 'SmartyBC' => $baseDir . '/lib/Smarty/SmartyBC.class.php', diff --git a/www/vendor/composer/autoload_static.php b/www/vendor/composer/autoload_static.php index eea27b16..2c526673 100644 --- a/www/vendor/composer/autoload_static.php +++ b/www/vendor/composer/autoload_static.php @@ -717,24 +717,25 @@ class ComposerStaticInit10fe8fe2ec4017b8644d2b64bcf398b9 'SebastianBergmann\\Timer\\ResourceUsageFormatter' => __DIR__ . '/..' . '/phpunit/php-timer/src/ResourceUsageFormatter.php', 'SebastianBergmann\\Timer\\TimeSinceStartOfRequestNotAvailableException' => __DIR__ . '/..' . '/phpunit/php-timer/src/exceptions/TimeSinceStartOfRequestNotAvailableException.php', 'SebastianBergmann\\Timer\\Timer' => __DIR__ . '/..' . '/phpunit/php-timer/src/Timer.php', - 'SebastianBergmann\\Type\\CallableType' => __DIR__ . '/..' . '/sebastian/type/src/CallableType.php', + 'SebastianBergmann\\Type\\CallableType' => __DIR__ . '/..' . '/sebastian/type/src/type/CallableType.php', 'SebastianBergmann\\Type\\Exception' => __DIR__ . '/..' . '/sebastian/type/src/exception/Exception.php', - 'SebastianBergmann\\Type\\FalseType' => __DIR__ . '/..' . '/sebastian/type/src/FalseType.php', - 'SebastianBergmann\\Type\\GenericObjectType' => __DIR__ . '/..' . '/sebastian/type/src/GenericObjectType.php', - 'SebastianBergmann\\Type\\IterableType' => __DIR__ . '/..' . '/sebastian/type/src/IterableType.php', - 'SebastianBergmann\\Type\\LogicException' => __DIR__ . '/..' . '/sebastian/type/src/exception/LogicException.php', - 'SebastianBergmann\\Type\\MixedType' => __DIR__ . '/..' . '/sebastian/type/src/MixedType.php', - 'SebastianBergmann\\Type\\NullType' => __DIR__ . '/..' . '/sebastian/type/src/NullType.php', - 'SebastianBergmann\\Type\\ObjectType' => __DIR__ . '/..' . '/sebastian/type/src/ObjectType.php', + 'SebastianBergmann\\Type\\FalseType' => __DIR__ . '/..' . '/sebastian/type/src/type/FalseType.php', + 'SebastianBergmann\\Type\\GenericObjectType' => __DIR__ . '/..' . '/sebastian/type/src/type/GenericObjectType.php', + 'SebastianBergmann\\Type\\IntersectionType' => __DIR__ . '/..' . '/sebastian/type/src/type/IntersectionType.php', + 'SebastianBergmann\\Type\\IterableType' => __DIR__ . '/..' . '/sebastian/type/src/type/IterableType.php', + 'SebastianBergmann\\Type\\MixedType' => __DIR__ . '/..' . '/sebastian/type/src/type/MixedType.php', + 'SebastianBergmann\\Type\\NeverType' => __DIR__ . '/..' . '/sebastian/type/src/type/NeverType.php', + 'SebastianBergmann\\Type\\NullType' => __DIR__ . '/..' . '/sebastian/type/src/type/NullType.php', + 'SebastianBergmann\\Type\\ObjectType' => __DIR__ . '/..' . '/sebastian/type/src/type/ObjectType.php', 'SebastianBergmann\\Type\\ReflectionMapper' => __DIR__ . '/..' . '/sebastian/type/src/ReflectionMapper.php', 'SebastianBergmann\\Type\\RuntimeException' => __DIR__ . '/..' . '/sebastian/type/src/exception/RuntimeException.php', - 'SebastianBergmann\\Type\\SimpleType' => __DIR__ . '/..' . '/sebastian/type/src/SimpleType.php', - 'SebastianBergmann\\Type\\StaticType' => __DIR__ . '/..' . '/sebastian/type/src/StaticType.php', - 'SebastianBergmann\\Type\\Type' => __DIR__ . '/..' . '/sebastian/type/src/Type.php', + 'SebastianBergmann\\Type\\SimpleType' => __DIR__ . '/..' . '/sebastian/type/src/type/SimpleType.php', + 'SebastianBergmann\\Type\\StaticType' => __DIR__ . '/..' . '/sebastian/type/src/type/StaticType.php', + 'SebastianBergmann\\Type\\Type' => __DIR__ . '/..' . '/sebastian/type/src/type/Type.php', 'SebastianBergmann\\Type\\TypeName' => __DIR__ . '/..' . '/sebastian/type/src/TypeName.php', - 'SebastianBergmann\\Type\\UnionType' => __DIR__ . '/..' . '/sebastian/type/src/UnionType.php', - 'SebastianBergmann\\Type\\UnknownType' => __DIR__ . '/..' . '/sebastian/type/src/UnknownType.php', - 'SebastianBergmann\\Type\\VoidType' => __DIR__ . '/..' . '/sebastian/type/src/VoidType.php', + 'SebastianBergmann\\Type\\UnionType' => __DIR__ . '/..' . '/sebastian/type/src/type/UnionType.php', + 'SebastianBergmann\\Type\\UnknownType' => __DIR__ . '/..' . '/sebastian/type/src/type/UnknownType.php', + 'SebastianBergmann\\Type\\VoidType' => __DIR__ . '/..' . '/sebastian/type/src/type/VoidType.php', 'SebastianBergmann\\Version' => __DIR__ . '/..' . '/sebastian/version/src/Version.php', 'Smarty' => __DIR__ . '/../..' . '/lib/Smarty/Smarty.class.php', 'SmartyBC' => __DIR__ . '/../..' . '/lib/Smarty/SmartyBC.class.php', diff --git a/www/vendor/composer/installed.json b/www/vendor/composer/installed.json index 1b3973bf..cae2572c 100644 --- a/www/vendor/composer/installed.json +++ b/www/vendor/composer/installed.json @@ -885,17 +885,17 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.18", - "version_normalized": "9.5.18.0", + "version": "9.5.19", + "version_normalized": "9.5.19.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "1b5856028273bfd855e60a887278857d872ec67a" + "reference": "35ea4b7f3acabb26f4bb640f8c30866c401da807" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1b5856028273bfd855e60a887278857d872ec67a", - "reference": "1b5856028273bfd855e60a887278857d872ec67a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/35ea4b7f3acabb26f4bb640f8c30866c401da807", + "reference": "35ea4b7f3acabb26f4bb640f8c30866c401da807", "shasum": "" }, "require": { @@ -925,7 +925,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": { @@ -936,7 +936,7 @@ "ext-soap": "*", "ext-xdebug": "*" }, - "time": "2022-03-08T06:52:28+00:00", + "time": "2022-03-15T09:57:31+00:00", "bin": [ "phpunit" ], @@ -975,7 +975,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.18" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.19" }, "funding": [ { @@ -1888,30 +1888,30 @@ }, { "name": "sebastian/type", - "version": "2.3.4", - "version_normalized": "2.3.4.0", + "version": "3.0.0", + "version_normalized": "3.0.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" }, - "time": "2021-06-15T12:49:02+00:00", + "time": "2022-03-15T09:54:48+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "3.0-dev" } }, "installation-source": "dist", @@ -1935,7 +1935,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": [ { diff --git a/www/vendor/composer/installed.php b/www/vendor/composer/installed.php index b506feff..35fa9904 100644 --- a/www/vendor/composer/installed.php +++ b/www/vendor/composer/installed.php @@ -5,7 +5,7 @@ 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '40edbe271dad56a18dff101983b5ed25f7cc5e85', + 'reference' => 'b075ee3dc5654a33da9e41fab338edb536695a25', 'name' => 'gullevek/corelibs', 'dev' => true, ), @@ -25,7 +25,7 @@ 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '40edbe271dad56a18dff101983b5ed25f7cc5e85', + 'reference' => 'b075ee3dc5654a33da9e41fab338edb536695a25', 'dev_requirement' => false, ), 'myclabs/deep-copy' => array( @@ -146,12 +146,12 @@ 'dev_requirement' => true, ), 'phpunit/phpunit' => array( - 'pretty_version' => '9.5.18', - 'version' => '9.5.18.0', + 'pretty_version' => '9.5.19', + 'version' => '9.5.19.0', 'type' => 'library', 'install_path' => __DIR__ . '/../phpunit/phpunit', 'aliases' => array(), - 'reference' => '1b5856028273bfd855e60a887278857d872ec67a', + 'reference' => '35ea4b7f3acabb26f4bb640f8c30866c401da807', 'dev_requirement' => true, ), 'sebastian/cli-parser' => array( @@ -281,12 +281,12 @@ 'dev_requirement' => true, ), 'sebastian/type' => array( - 'pretty_version' => '2.3.4', - 'version' => '2.3.4.0', + 'pretty_version' => '3.0.0', + 'version' => '3.0.0.0', 'type' => 'library', 'install_path' => __DIR__ . '/../sebastian/type', 'aliases' => array(), - 'reference' => 'b8cd8a1c753c90bc1a0f5372170e3e489136f914', + 'reference' => 'b233b84bc4465aff7b57cf1c4bc75c86d00d6dad', 'dev_requirement' => true, ), 'sebastian/version' => array( diff --git a/www/vendor/phpunit/phpunit/ChangeLog-9.5.md b/www/vendor/phpunit/phpunit/ChangeLog-9.5.md index 0f428949..48d195d3 100644 --- a/www/vendor/phpunit/phpunit/ChangeLog-9.5.md +++ b/www/vendor/phpunit/phpunit/ChangeLog-9.5.md @@ -2,6 +2,14 @@ All notable changes of the PHPUnit 9.5 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles. +## [9.5.19] - 2022-03-15 + +### Fixed + +* [#4929](https://github.com/sebastianbergmann/phpunit/issues/4929): Test Double code generator does not handle new expressions inside parameter default values +* [#4932](https://github.com/sebastianbergmann/phpunit/issues/4932): Backport support for intersection types from PHPUnit 10 to PHPUnit 9.5 +* [#4933](https://github.com/sebastianbergmann/phpunit/issues/4933): Backport support for `never` type from PHPUnit 10 to PHPUnit 9.5 + ## [9.5.18] - 2022-03-08 ### Fixed @@ -142,6 +150,7 @@ All notable changes of the PHPUnit 9.5 release series are documented in this fil * [#4535](https://github.com/sebastianbergmann/phpunit/issues/4535): `getMockFromWsdl()` does not handle methods that do not have parameters correctly +[9.5.19]: https://github.com/sebastianbergmann/phpunit/compare/9.5.18...9.5.19 [9.5.18]: https://github.com/sebastianbergmann/phpunit/compare/9.5.17...9.5.18 [9.5.17]: https://github.com/sebastianbergmann/phpunit/compare/9.5.16...9.5.17 [9.5.16]: https://github.com/sebastianbergmann/phpunit/compare/dc738383c519243b0a967f63943a848d3fd861aa...9.5.16 diff --git a/www/vendor/phpunit/phpunit/composer.json b/www/vendor/phpunit/phpunit/composer.json index 4000dd89..e399e175 100644 --- a/www/vendor/phpunit/phpunit/composer.json +++ b/www/vendor/phpunit/phpunit/composer.json @@ -47,7 +47,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": { diff --git a/www/vendor/phpunit/phpunit/src/Framework/MockObject/Generator.php b/www/vendor/phpunit/phpunit/src/Framework/MockObject/Generator.php index cb8531cd..5c347756 100644 --- a/www/vendor/phpunit/phpunit/src/Framework/MockObject/Generator.php +++ b/www/vendor/phpunit/phpunit/src/Framework/MockObject/Generator.php @@ -171,6 +171,67 @@ final class Generator ); } + /** + * @psalm-param list $interfaces + * + * @throws RuntimeException + * @throws UnknownTypeException + */ + public function getMockForInterfaces(array $interfaces, bool $callAutoload = true): MockObject + { + if (count($interfaces) < 2) { + throw new RuntimeException('At least two interfaces must be specified'); + } + + foreach ($interfaces as $interface) { + if (!interface_exists($interface, $callAutoload)) { + throw new UnknownTypeException($interface); + } + } + + sort($interfaces); + + $methods = []; + + foreach ($interfaces as $interface) { + $methods = array_merge($methods, $this->getClassMethods($interface)); + } + + if (count(array_unique($methods)) < count($methods)) { + throw new RuntimeException('Interfaces must not declare the same method'); + } + + $unqualifiedNames = []; + + foreach ($interfaces as $interface) { + $parts = explode('\\', $interface); + $unqualifiedNames[] = array_pop($parts); + } + + sort($unqualifiedNames); + + do { + $intersectionName = sprintf( + 'Intersection_%s_%s', + implode('_', $unqualifiedNames), + substr(md5((string) mt_rand()), 0, 8) + ); + } while (interface_exists($intersectionName, false)); + + $template = $this->getTemplate('intersection.tpl'); + + $template->setVar( + [ + 'intersection' => $intersectionName, + 'interfaces' => implode(', ', $interfaces), + ] + ); + + eval($template->render()); + + return $this->getMock($intersectionName); + } + /** * Returns a mock object for the specified abstract class with all abstract * methods of the class mocked. diff --git a/www/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/intersection.tpl b/www/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/intersection.tpl new file mode 100644 index 00000000..75cd27a6 --- /dev/null +++ b/www/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/intersection.tpl @@ -0,0 +1,5 @@ +declare(strict_types=1); + +interface {intersection} extends {interfaces} +{ +} diff --git a/www/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_method_void.tpl b/www/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_method_never_or_void.tpl similarity index 100% rename from www/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_method_void.tpl rename to www/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_method_never_or_void.tpl diff --git a/www/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/proxied_method_void.tpl b/www/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/proxied_method_never_or_void.tpl similarity index 100% rename from www/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/proxied_method_void.tpl rename to www/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/proxied_method_never_or_void.tpl diff --git a/www/vendor/phpunit/phpunit/src/Framework/MockObject/Invocation.php b/www/vendor/phpunit/phpunit/src/Framework/MockObject/Invocation.php index 39293834..0166c58c 100644 --- a/www/vendor/phpunit/phpunit/src/Framework/MockObject/Invocation.php +++ b/www/vendor/phpunit/phpunit/src/Framework/MockObject/Invocation.php @@ -121,100 +121,141 @@ final class Invocation implements SelfDescribing return null; } - $union = false; + $intersection = false; + $union = false; if (strpos($this->returnType, '|') !== false) { $types = explode('|', $this->returnType); $union = true; + } elseif (strpos($this->returnType, '&') !== false) { + $types = explode('&', $this->returnType); + $intersection = true; } else { $types = [$this->returnType]; } $types = array_map('strtolower', $types); - if (in_array('', $types, true) || - in_array('null', $types, true) || - in_array('mixed', $types, true) || - in_array('void', $types, true)) { - return null; - } + if (!$intersection) { + if (in_array('', $types, true) || + in_array('null', $types, true) || + in_array('mixed', $types, true) || + in_array('void', $types, true)) { + return null; + } - if (in_array('false', $types, true) || - in_array('bool', $types, true)) { - return false; - } + if (in_array('false', $types, true) || + in_array('bool', $types, true)) { + return false; + } - if (in_array('float', $types, true)) { - return 0.0; - } + if (in_array('float', $types, true)) { + return 0.0; + } - if (in_array('int', $types, true)) { - return 0; - } + if (in_array('int', $types, true)) { + return 0; + } - if (in_array('string', $types, true)) { - return ''; - } + if (in_array('string', $types, true)) { + return ''; + } - if (in_array('array', $types, true)) { - return []; - } + if (in_array('array', $types, true)) { + return []; + } - if (in_array('static', $types, true)) { - try { - return (new Instantiator)->instantiate(get_class($this->object)); - } catch (Throwable $t) { - throw new RuntimeException( - $t->getMessage(), - (int) $t->getCode(), - $t - ); + if (in_array('static', $types, true)) { + try { + return (new Instantiator)->instantiate(get_class($this->object)); + } catch (Throwable $t) { + throw new RuntimeException( + $t->getMessage(), + (int) $t->getCode(), + $t + ); + } + } + + if (in_array('object', $types, true)) { + return new stdClass; + } + + if (in_array('callable', $types, true) || + in_array('closure', $types, true)) { + return static function (): void + { + }; + } + + if (in_array('traversable', $types, true) || + in_array('generator', $types, true) || + in_array('iterable', $types, true)) { + $generator = static function (): \Generator + { + yield from []; + }; + + return $generator(); + } + + if (!$union) { + try { + return (new Generator)->getMock($this->returnType, [], [], '', false); + } catch (Throwable $t) { + if ($t instanceof Exception) { + throw $t; + } + + throw new RuntimeException( + $t->getMessage(), + (int) $t->getCode(), + $t + ); + } } } - if (in_array('object', $types, true)) { - return new stdClass; - } + $reason = ''; - if (in_array('callable', $types, true) || - in_array('closure', $types, true)) { - return static function (): void - { - }; - } + if ($union) { + $reason = ' because the declared return type is a union'; + } elseif ($intersection) { + $reason = ' because the declared return type is an intersection'; - if (in_array('traversable', $types, true) || - in_array('generator', $types, true) || - in_array('iterable', $types, true)) { - $generator = static function (): \Generator - { - yield from []; - }; + $onlyInterfaces = true; - return $generator(); - } + foreach ($types as $type) { + if (!interface_exists($type)) { + $onlyInterfaces = false; - if (!$union) { - try { - return (new Generator)->getMock($this->returnType, [], [], '', false); - } catch (Throwable $t) { - throw new RuntimeException( - sprintf( - 'Return value for %s::%s() cannot be generated: %s', - $this->className, - $this->methodName, - $t->getMessage(), - ), - (int) $t->getCode(), - ); + break; + } + } + + if ($onlyInterfaces) { + try { + return (new Generator)->getMockForInterfaces($types); + } catch (Throwable $t) { + throw new RuntimeException( + sprintf( + 'Return value for %s::%s() cannot be generated: %s', + $this->className, + $this->methodName, + $t->getMessage(), + ), + (int) $t->getCode(), + ); + } } } throw new RuntimeException( sprintf( - 'Return value for %s::%s() cannot be generated because the declared return type is a union, please configure a return value for this method', + 'Return value for %s::%s() cannot be generated%s, please configure a return value for this method', $this->className, - $this->methodName + $this->methodName, + $reason ) ); } diff --git a/www/vendor/phpunit/phpunit/src/Framework/MockObject/MockMethod.php b/www/vendor/phpunit/phpunit/src/Framework/MockObject/MockMethod.php index 5e02cae5..d3bd3266 100644 --- a/www/vendor/phpunit/phpunit/src/Framework/MockObject/MockMethod.php +++ b/www/vendor/phpunit/phpunit/src/Framework/MockObject/MockMethod.php @@ -10,14 +10,20 @@ namespace PHPUnit\Framework\MockObject; use const DIRECTORY_SEPARATOR; +use function explode; use function implode; +use function is_object; use function is_string; use function preg_match; use function preg_replace; use function sprintf; +use function strlen; +use function strpos; +use function substr; use function substr_count; use function trim; use function var_export; +use ReflectionIntersectionType; use ReflectionMethod; use ReflectionNamedType; use ReflectionParameter; @@ -27,7 +33,6 @@ use SebastianBergmann\Template\Template; use SebastianBergmann\Type\ReflectionMapper; use SebastianBergmann\Type\Type; use SebastianBergmann\Type\UnknownType; -use SebastianBergmann\Type\VoidType; /** * @internal This class is not covered by the backward compatibility promise for PHPUnit @@ -134,7 +139,7 @@ final class MockMethod $modifier, self::getMethodParametersForDeclaration($method), self::getMethodParametersForCall($method), - (new ReflectionMapper)->fromMethodReturnType($method), + (new ReflectionMapper)->fromReturnType($method), $reference, $callOriginalMethod, $method->isStatic(), @@ -186,9 +191,9 @@ final class MockMethod { if ($this->static) { $templateFile = 'mocked_static_method.tpl'; - } elseif ($this->returnType instanceof VoidType) { + } elseif ($this->returnType->isNever() || $this->returnType->isVoid()) { $templateFile = sprintf( - '%s_method_void.tpl', + '%s_method_never_or_void.tpl', $this->callOriginalMethod ? 'proxied' : 'mocked' ); } else { @@ -304,7 +309,7 @@ final class MockMethod } if ($type !== null) { - if ($typeName !== 'mixed' && $parameter->allowsNull() && !$type instanceof ReflectionUnionType) { + if ($typeName !== 'mixed' && $parameter->allowsNull() && !$type instanceof ReflectionIntersectionType && !$type instanceof ReflectionUnionType) { $nullable = '?'; } @@ -317,6 +322,8 @@ final class MockMethod $type, $method->getDeclaringClass()->getName() ); + } elseif ($type instanceof ReflectionIntersectionType) { + $typeDeclaration = self::intersectionTypeAsString($type); } } @@ -369,7 +376,25 @@ final class MockMethod private static function exportDefaultValue(ReflectionParameter $parameter): string { try { - return (string) var_export($parameter->getDefaultValue(), true); + $defaultValue = $parameter->getDefaultValue(); + + if (!is_object($defaultValue)) { + return (string) var_export($defaultValue, true); + } + + $parameterAsString = $parameter->__toString(); + + return (string) explode( + ' = ', + substr( + substr( + $parameterAsString, + strpos($parameterAsString, ' ') + strlen(' ') + ), + 0, + -2 + ) + )[1]; // @codeCoverageIgnoreStart } catch (\ReflectionException $e) { throw new ReflectionException( @@ -395,4 +420,15 @@ final class MockMethod return implode('|', $types) . ' '; } + + private static function intersectionTypeAsString(ReflectionIntersectionType $intersection): string + { + $types = []; + + foreach ($intersection->getTypes() as $type) { + $types[] = $type; + } + + return implode('&', $types) . ' '; + } } diff --git a/www/vendor/phpunit/phpunit/src/Runner/Version.php b/www/vendor/phpunit/phpunit/src/Runner/Version.php index d3dd643b..c68bc989 100644 --- a/www/vendor/phpunit/phpunit/src/Runner/Version.php +++ b/www/vendor/phpunit/phpunit/src/Runner/Version.php @@ -41,7 +41,7 @@ final class Version } if (self::$version === '') { - self::$version = (new VersionId('9.5.18', dirname(__DIR__, 2)))->getVersion(); + self::$version = (new VersionId('9.5.19', dirname(__DIR__, 2)))->getVersion(); } return self::$version; diff --git a/www/vendor/sebastian/type/ChangeLog.md b/www/vendor/sebastian/type/ChangeLog.md index 73837bde..258f6b70 100644 --- a/www/vendor/sebastian/type/ChangeLog.md +++ b/www/vendor/sebastian/type/ChangeLog.md @@ -2,6 +2,31 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. +## [4.0.0] - 2022-MM-DD + +### Removed + +* This component is no longer supported on PHP 7.3 and PHP 7.4 + +## [3.0.0] - 2022-03-15 + +### Added + +* Support for intersection types introduced in PHP 8.1 +* Support for the `never` return type introduced in PHP 8.1 +* Added `Type::isCallable()`, `Type::isGenericObject()`, `Type::isIterable()`, `Type::isMixed()`, `Type::isNever()`, `Type::isNull()`, `Type::isObject()`, `Type::isSimple()`, `Type::isStatic()`, `Type::isUnion()`, `Type::isUnknown()`, and `Type::isVoid()` + +### Changed + +* Renamed `ReflectionMapper::fromMethodReturnType(ReflectionMethod $method)` to `ReflectionMapper::fromReturnType(ReflectionFunctionAbstract $functionOrMethod)` + +### Removed + +* Removed `Type::getReturnTypeDeclaration()` (use `Type::asString()` instead and prefix its result with `': '`) +* Removed `TypeName::getNamespaceName()` (use `TypeName::namespaceName()` instead) +* Removed `TypeName::getSimpleName()` (use `TypeName::simpleName()` instead) +* Removed `TypeName::getQualifiedName()` (use `TypeName::qualifiedName()` instead) + ## [2.3.4] - 2021-06-15 * Fixed regression introduced in 2.3.3 @@ -105,6 +130,8 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt * Initial release based on [code contributed by Michel Hartmann to PHPUnit](https://github.com/sebastianbergmann/phpunit/pull/3673) +[4.0.0]: https://github.com/sebastianbergmann/type/compare/3.0...master +[3.0.0]: https://github.com/sebastianbergmann/type/compare/2.3.4...3.0.0 [2.3.4]: https://github.com/sebastianbergmann/type/compare/ca39369c41313ed12c071ed38ecda8fcdb248859...2.3.4 [2.3.3]: https://github.com/sebastianbergmann/type/compare/2.3.2...ca39369c41313ed12c071ed38ecda8fcdb248859 [2.3.2]: https://github.com/sebastianbergmann/type/compare/2.3.1...2.3.2 diff --git a/www/vendor/sebastian/type/LICENSE b/www/vendor/sebastian/type/LICENSE index b840591a..f4e4a328 100644 --- a/www/vendor/sebastian/type/LICENSE +++ b/www/vendor/sebastian/type/LICENSE @@ -1,6 +1,6 @@ sebastian/type -Copyright (c) 2019-2020, Sebastian Bergmann . +Copyright (c) 2019-2022, Sebastian Bergmann . All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/www/vendor/sebastian/type/composer.json b/www/vendor/sebastian/type/composer.json index b02d8e92..10b32cd8 100644 --- a/www/vendor/sebastian/type/composer.json +++ b/www/vendor/sebastian/type/composer.json @@ -19,7 +19,7 @@ "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.5" }, "config": { "platform": { @@ -38,12 +38,13 @@ "tests/_fixture" ], "files": [ - "tests/_fixture/callback_function.php" + "tests/_fixture/callback_function.php", + "tests/_fixture/functions_that_declare_return_types.php" ] }, "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "3.0-dev" } } } diff --git a/www/vendor/sebastian/type/src/ReflectionMapper.php b/www/vendor/sebastian/type/src/ReflectionMapper.php index db9baf42..d9b6cb1e 100644 --- a/www/vendor/sebastian/type/src/ReflectionMapper.php +++ b/www/vendor/sebastian/type/src/ReflectionMapper.php @@ -10,7 +10,8 @@ namespace SebastianBergmann\Type; use function assert; -use function sprintf; +use ReflectionFunctionAbstract; +use ReflectionIntersectionType; use ReflectionMethod; use ReflectionNamedType; use ReflectionType; @@ -18,27 +19,27 @@ use ReflectionUnionType; final class ReflectionMapper { - public function fromMethodReturnType(ReflectionMethod $method): Type + public function fromReturnType(ReflectionFunctionAbstract $functionOrMethod): Type { - if (!$this->reflectionMethodHasReturnType($method)) { + if (!$this->hasReturnType($functionOrMethod)) { return new UnknownType; } - $returnType = $this->reflectionMethodGetReturnType($method); + $returnType = $this->returnType($functionOrMethod); - assert($returnType instanceof ReflectionNamedType || $returnType instanceof ReflectionUnionType); + assert($returnType instanceof ReflectionNamedType || $returnType instanceof ReflectionUnionType || $returnType instanceof ReflectionIntersectionType); if ($returnType instanceof ReflectionNamedType) { - if ($returnType->getName() === 'self') { + if ($functionOrMethod instanceof ReflectionMethod && $returnType->getName() === 'self') { return ObjectType::fromName( - $method->getDeclaringClass()->getName(), + $functionOrMethod->getDeclaringClass()->getName(), $returnType->allowsNull() ); } - if ($returnType->getName() === 'static') { + if ($functionOrMethod instanceof ReflectionMethod && $returnType->getName() === 'static') { return new StaticType( - TypeName::fromReflection($method->getDeclaringClass()), + TypeName::fromReflection($functionOrMethod->getDeclaringClass()), $returnType->allowsNull() ); } @@ -47,24 +48,9 @@ final class ReflectionMapper return new MixedType; } - if ($returnType->getName() === 'parent') { - $parentClass = $method->getDeclaringClass()->getParentClass(); - - // @codeCoverageIgnoreStart - if ($parentClass === false) { - throw new RuntimeException( - sprintf( - '%s::%s() has a "parent" return type declaration but %s does not have a parent class', - $method->getDeclaringClass()->getName(), - $method->getName(), - $method->getDeclaringClass()->getName() - ) - ); - } - // @codeCoverageIgnoreEnd - + if ($functionOrMethod instanceof ReflectionMethod && $returnType->getName() === 'parent') { return ObjectType::fromName( - $parentClass->getName(), + $functionOrMethod->getDeclaringClass()->getParentClass()->getName(), $returnType->allowsNull() ); } @@ -75,16 +61,14 @@ final class ReflectionMapper ); } - assert($returnType instanceof ReflectionUnionType); + assert($returnType instanceof ReflectionUnionType || $returnType instanceof ReflectionIntersectionType); $types = []; foreach ($returnType->getTypes() as $type) { - assert($type instanceof ReflectionNamedType); - - if ($type->getName() === 'self') { + if ($functionOrMethod instanceof ReflectionMethod && $type->getName() === 'self') { $types[] = ObjectType::fromName( - $method->getDeclaringClass()->getName(), + $functionOrMethod->getDeclaringClass()->getName(), false ); } else { @@ -92,32 +76,36 @@ final class ReflectionMapper } } - return new UnionType(...$types); + if ($returnType instanceof ReflectionUnionType) { + return new UnionType(...$types); + } + + return new IntersectionType(...$types); } - private function reflectionMethodHasReturnType(ReflectionMethod $method): bool + private function hasReturnType(ReflectionFunctionAbstract $functionOrMethod): bool { - if ($method->hasReturnType()) { + if ($functionOrMethod->hasReturnType()) { return true; } - if (!method_exists($method, 'hasTentativeReturnType')) { + if (!method_exists($functionOrMethod, 'hasTentativeReturnType')) { return false; } - return $method->hasTentativeReturnType(); + return $functionOrMethod->hasTentativeReturnType(); } - private function reflectionMethodGetReturnType(ReflectionMethod $method): ?ReflectionType + private function returnType(ReflectionFunctionAbstract $functionOrMethod): ?ReflectionType { - if ($method->hasReturnType()) { - return $method->getReturnType(); + if ($functionOrMethod->hasReturnType()) { + return $functionOrMethod->getReturnType(); } - if (!method_exists($method, 'getTentativeReturnType')) { + if (!method_exists($functionOrMethod, 'getTentativeReturnType')) { return null; } - return $method->getTentativeReturnType(); + return $functionOrMethod->getTentativeReturnType(); } } diff --git a/www/vendor/sebastian/type/src/TypeName.php b/www/vendor/sebastian/type/src/TypeName.php index b076e89e..17d477cf 100644 --- a/www/vendor/sebastian/type/src/TypeName.php +++ b/www/vendor/sebastian/type/src/TypeName.php @@ -76,36 +76,6 @@ final class TypeName : $this->namespaceName . '\\' . $this->simpleName; } - /** - * @deprecated Use namespaceName() instead - * - * @codeCoverageIgnore - */ - public function getNamespaceName(): ?string - { - return $this->namespaceName(); - } - - /** - * @deprecated Use simpleName() instead - * - * @codeCoverageIgnore - */ - public function getSimpleName(): string - { - return $this->simpleName(); - } - - /** - * @deprecated Use qualifiedName() instead - * - * @codeCoverageIgnore - */ - public function getQualifiedName(): string - { - return $this->qualifiedName(); - } - public function isNamespaced(): bool { return $this->namespaceName !== null; diff --git a/www/vendor/sebastian/type/src/exception/LogicException.php b/www/vendor/sebastian/type/src/exception/LogicException.php deleted file mode 100644 index 24358216..00000000 --- a/www/vendor/sebastian/type/src/exception/LogicException.php +++ /dev/null @@ -1,14 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace SebastianBergmann\Type; - -final class LogicException extends \LogicException implements Exception -{ -} diff --git a/www/vendor/sebastian/type/src/CallableType.php b/www/vendor/sebastian/type/src/type/CallableType.php similarity index 98% rename from www/vendor/sebastian/type/src/CallableType.php rename to www/vendor/sebastian/type/src/type/CallableType.php index 026762ea..90f5073b 100644 --- a/www/vendor/sebastian/type/src/CallableType.php +++ b/www/vendor/sebastian/type/src/type/CallableType.php @@ -17,7 +17,6 @@ use function function_exists; use function is_array; use function is_object; use function is_string; -use function strpos; use Closure; use ReflectionClass; use ReflectionException; @@ -85,6 +84,11 @@ final class CallableType extends Type return $this->allowsNull; } + public function isCallable(): bool + { + return true; + } + private function isClosure(ObjectType $type): bool { return !$type->className()->isNamespaced() && $type->className()->simpleName() === Closure::class; diff --git a/www/vendor/sebastian/type/src/FalseType.php b/www/vendor/sebastian/type/src/type/FalseType.php similarity index 79% rename from www/vendor/sebastian/type/src/FalseType.php rename to www/vendor/sebastian/type/src/type/FalseType.php index 425f363c..652b828e 100644 --- a/www/vendor/sebastian/type/src/FalseType.php +++ b/www/vendor/sebastian/type/src/type/FalseType.php @@ -32,15 +32,8 @@ final class FalseType extends Type return false; } - /** - * @deprecated - * - * @codeCoverageIgnore - * - * @throws LogicException - */ - public function getReturnTypeDeclaration(): string + public function isFalse(): bool { - throw new LogicException; + return true; } } diff --git a/www/vendor/sebastian/type/src/GenericObjectType.php b/www/vendor/sebastian/type/src/type/GenericObjectType.php similarity index 92% rename from www/vendor/sebastian/type/src/GenericObjectType.php rename to www/vendor/sebastian/type/src/type/GenericObjectType.php index 6871008b..1609b326 100644 --- a/www/vendor/sebastian/type/src/GenericObjectType.php +++ b/www/vendor/sebastian/type/src/type/GenericObjectType.php @@ -43,4 +43,9 @@ final class GenericObjectType extends Type { return $this->allowsNull; } + + public function isGenericObject(): bool + { + return true; + } } diff --git a/www/vendor/sebastian/type/src/type/IntersectionType.php b/www/vendor/sebastian/type/src/type/IntersectionType.php new file mode 100644 index 00000000..c4f83f45 --- /dev/null +++ b/www/vendor/sebastian/type/src/type/IntersectionType.php @@ -0,0 +1,115 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\Type; + +use function array_unique; +use function assert; +use function count; +use function implode; +use function sort; + +final class IntersectionType extends Type +{ + /** + * @psalm-var list + */ + private $types; + + /** + * @throws RuntimeException + */ + public function __construct(Type ...$types) + { + $this->ensureMinimumOfTwoTypes(...$types); + $this->ensureOnlyValidTypes(...$types); + $this->ensureNoDuplicateTypes(...$types); + + $this->types = $types; + } + + public function isAssignable(Type $other): bool + { + return $other->isObject(); + } + + public function asString(): string + { + return $this->name(); + } + + public function name(): string + { + $types = []; + + foreach ($this->types as $type) { + $types[] = $type->name(); + } + + sort($types); + + return implode('&', $types); + } + + public function allowsNull(): bool + { + return false; + } + + public function isIntersection(): bool + { + return true; + } + + /** + * @throws RuntimeException + */ + private function ensureMinimumOfTwoTypes(Type ...$types): void + { + if (count($types) < 2) { + throw new RuntimeException( + 'An intersection type must be composed of at least two types' + ); + } + } + + /** + * @throws RuntimeException + */ + private function ensureOnlyValidTypes(Type ...$types): void + { + foreach ($types as $type) { + if (!$type->isObject()) { + throw new RuntimeException( + 'An intersection type can only be composed of interfaces and classes' + ); + } + } + } + + /** + * @throws RuntimeException + */ + private function ensureNoDuplicateTypes(Type ...$types): void + { + $names = []; + + foreach ($types as $type) { + assert($type instanceof ObjectType); + + $names[] = $type->className()->qualifiedName(); + } + + if (count(array_unique($names)) < count($names)) { + throw new RuntimeException( + 'An intersection type must not contain duplicate types' + ); + } + } +} diff --git a/www/vendor/sebastian/type/src/IterableType.php b/www/vendor/sebastian/type/src/type/IterableType.php similarity index 96% rename from www/vendor/sebastian/type/src/IterableType.php rename to www/vendor/sebastian/type/src/type/IterableType.php index c5bc6627..eb64895a 100644 --- a/www/vendor/sebastian/type/src/IterableType.php +++ b/www/vendor/sebastian/type/src/type/IterableType.php @@ -73,4 +73,9 @@ final class IterableType extends Type { return $this->allowsNull; } + + public function isIterable(): bool + { + return true; + } } diff --git a/www/vendor/sebastian/type/src/MixedType.php b/www/vendor/sebastian/type/src/type/MixedType.php similarity index 90% rename from www/vendor/sebastian/type/src/MixedType.php rename to www/vendor/sebastian/type/src/type/MixedType.php index 7ad9191d..23e8a7ba 100644 --- a/www/vendor/sebastian/type/src/MixedType.php +++ b/www/vendor/sebastian/type/src/type/MixedType.php @@ -30,4 +30,9 @@ final class MixedType extends Type { return true; } + + public function isMixed(): bool + { + return true; + } } diff --git a/www/vendor/sebastian/type/src/type/NeverType.php b/www/vendor/sebastian/type/src/type/NeverType.php new file mode 100644 index 00000000..e2892a59 --- /dev/null +++ b/www/vendor/sebastian/type/src/type/NeverType.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace SebastianBergmann\Type; + +final class NeverType extends Type +{ + public function isAssignable(Type $other): bool + { + return $other instanceof self; + } + + public function name(): string + { + return 'never'; + } + + public function allowsNull(): bool + { + return false; + } + + public function isNever(): bool + { + return true; + } +} diff --git a/www/vendor/sebastian/type/src/NullType.php b/www/vendor/sebastian/type/src/type/NullType.php similarity index 82% rename from www/vendor/sebastian/type/src/NullType.php rename to www/vendor/sebastian/type/src/type/NullType.php index 8481fceb..1cfa8fcb 100644 --- a/www/vendor/sebastian/type/src/NullType.php +++ b/www/vendor/sebastian/type/src/type/NullType.php @@ -26,18 +26,13 @@ final class NullType extends Type return 'null'; } - /** - * @deprecated - * - * @codeCoverageIgnore - */ - public function getReturnTypeDeclaration(): string - { - return ''; - } - public function allowsNull(): bool { return true; } + + public function isNull(): bool + { + return true; + } } diff --git a/www/vendor/sebastian/type/src/ObjectType.php b/www/vendor/sebastian/type/src/type/ObjectType.php similarity index 95% rename from www/vendor/sebastian/type/src/ObjectType.php rename to www/vendor/sebastian/type/src/type/ObjectType.php index c71273cb..8d5fdb90 100644 --- a/www/vendor/sebastian/type/src/ObjectType.php +++ b/www/vendor/sebastian/type/src/type/ObjectType.php @@ -63,4 +63,9 @@ final class ObjectType extends Type { return $this->className; } + + public function isObject(): bool + { + return true; + } } diff --git a/www/vendor/sebastian/type/src/SimpleType.php b/www/vendor/sebastian/type/src/type/SimpleType.php similarity index 96% rename from www/vendor/sebastian/type/src/SimpleType.php rename to www/vendor/sebastian/type/src/type/SimpleType.php index 8bf0bf7d..b31ec124 100644 --- a/www/vendor/sebastian/type/src/SimpleType.php +++ b/www/vendor/sebastian/type/src/type/SimpleType.php @@ -67,6 +67,11 @@ final class SimpleType extends Type return $this->value; } + public function isSimple(): bool + { + return true; + } + private function normalize(string $name): string { $name = strtolower($name); diff --git a/www/vendor/sebastian/type/src/StaticType.php b/www/vendor/sebastian/type/src/type/StaticType.php similarity index 94% rename from www/vendor/sebastian/type/src/StaticType.php rename to www/vendor/sebastian/type/src/type/StaticType.php index 6833094d..0fb043b1 100644 --- a/www/vendor/sebastian/type/src/StaticType.php +++ b/www/vendor/sebastian/type/src/type/StaticType.php @@ -57,4 +57,9 @@ final class StaticType extends Type { return $this->allowsNull; } + + public function isStatic(): bool + { + return true; + } } diff --git a/www/vendor/sebastian/type/src/Type.php b/www/vendor/sebastian/type/src/type/Type.php similarity index 64% rename from www/vendor/sebastian/type/src/Type.php rename to www/vendor/sebastian/type/src/type/Type.php index 679223d9..bd923702 100644 --- a/www/vendor/sebastian/type/src/Type.php +++ b/www/vendor/sebastian/type/src/type/Type.php @@ -9,9 +9,11 @@ */ namespace SebastianBergmann\Type; +use const PHP_VERSION; use function get_class; use function gettype; use function strtolower; +use function version_compare; abstract class Type { @@ -38,6 +40,10 @@ abstract class Type public static function fromName(string $typeName, bool $allowsNull): self { + if (version_compare(PHP_VERSION, '8.1.0-dev', '>=') && strtolower($typeName) === 'never') { + return new NeverType; + } + switch (strtolower($typeName)) { case 'callable': return new CallableType($allowsNull); @@ -83,17 +89,77 @@ abstract class Type return ($this->allowsNull() ? '?' : '') . $this->name(); } - /** - * @deprecated - * - * @codeCoverageIgnore - */ - public function getReturnTypeDeclaration(): string + public function isCallable(): bool { - return ': ' . $this->asString(); + return false; } - abstract public function isAssignable(Type $other): bool; + public function isFalse(): bool + { + return false; + } + + public function isGenericObject(): bool + { + return false; + } + + public function isIntersection(): bool + { + return false; + } + + public function isIterable(): bool + { + return false; + } + + public function isMixed(): bool + { + return false; + } + + public function isNever(): bool + { + return false; + } + + public function isNull(): bool + { + return false; + } + + public function isObject(): bool + { + return false; + } + + public function isSimple(): bool + { + return false; + } + + public function isStatic(): bool + { + return false; + } + + public function isUnion(): bool + { + return false; + } + + public function isUnknown(): bool + { + return false; + } + + public function isVoid(): bool + { + return false; + } + + abstract public function isAssignable(self $other): bool; abstract public function name(): string; diff --git a/www/vendor/sebastian/type/src/UnionType.php b/www/vendor/sebastian/type/src/type/UnionType.php similarity index 93% rename from www/vendor/sebastian/type/src/UnionType.php rename to www/vendor/sebastian/type/src/type/UnionType.php index 10c4a49b..bdb9f1da 100644 --- a/www/vendor/sebastian/type/src/UnionType.php +++ b/www/vendor/sebastian/type/src/type/UnionType.php @@ -47,16 +47,6 @@ final class UnionType extends Type return $this->name(); } - /** - * @deprecated - * - * @codeCoverageIgnore - */ - public function getReturnTypeDeclaration(): string - { - return ': ' . $this->name(); - } - public function name(): string { $types = []; @@ -81,6 +71,11 @@ final class UnionType extends Type return false; } + public function isUnion(): bool + { + return true; + } + /** * @throws RuntimeException */ diff --git a/www/vendor/sebastian/type/src/UnknownType.php b/www/vendor/sebastian/type/src/type/UnknownType.php similarity index 82% rename from www/vendor/sebastian/type/src/UnknownType.php rename to www/vendor/sebastian/type/src/type/UnknownType.php index dde4c678..6df0379b 100644 --- a/www/vendor/sebastian/type/src/UnknownType.php +++ b/www/vendor/sebastian/type/src/type/UnknownType.php @@ -26,18 +26,13 @@ final class UnknownType extends Type return ''; } - /** - * @deprecated - * - * @codeCoverageIgnore - */ - public function getReturnTypeDeclaration(): string - { - return ''; - } - public function allowsNull(): bool { return true; } + + public function isUnknown(): bool + { + return true; + } } diff --git a/www/vendor/sebastian/type/src/VoidType.php b/www/vendor/sebastian/type/src/type/VoidType.php similarity index 89% rename from www/vendor/sebastian/type/src/VoidType.php rename to www/vendor/sebastian/type/src/type/VoidType.php index 18c01756..5f674cfd 100644 --- a/www/vendor/sebastian/type/src/VoidType.php +++ b/www/vendor/sebastian/type/src/type/VoidType.php @@ -25,4 +25,9 @@ final class VoidType extends Type { return false; } + + public function isVoid(): bool + { + return true; + } }