From 818dbcf1075c74c928b9b74aa7154963b30f1359 Mon Sep 17 00:00:00 2001 From: Alex P Date: Wed, 9 Nov 2022 10:11:31 +0200 Subject: [PATCH 1/4] Add isolated container and dhii modularity deps --- bootstrap.php | 16 +- composer.json | 17 +- composer.lock | 195 ++++++++++++------ lib/README.md | 5 + .../ClearableContainerInterface.php | 19 ++ .../Collection/ContainerFactoryInterface.php | 27 +++ .../Dhii/Collection/ContainerInterface.php | 16 ++ .../Collection/CountableListInterface.php | 21 ++ .../Dhii/Collection/CountableMapInterface.php | 21 ++ .../Dhii/Collection/CountableSetInterface.php | 21 ++ .../Dhii/Collection/HasCapableInterface.php | 29 +++ .../Collection/HasItemCapableInterface.php | 30 +++ .../Dhii/Collection/MapFactoryInterface.php | 27 +++ lib/packages/Dhii/Collection/MapInterface.php | 21 ++ .../Collection/MutableContainerInterface.php | 42 ++++ .../Dhii/Collection/SetFactoryInterface.php | 30 +++ lib/packages/Dhii/Collection/SetInterface.php | 21 ++ .../WritableContainerFactoryInterface.php | 20 ++ .../Collection/WritableContainerInterface.php | 58 ++++++ .../WritableMapFactoryInterface.php | 22 ++ .../Dhii/Collection/WritableMapInterface.php | 15 ++ .../WritableSetFactoryInterface.php | 20 ++ .../Dhii/Collection/WritableSetInterface.php | 54 +++++ .../Dhii/Container/AliasingContainer.php | 87 ++++++++ .../Dhii/Container/CachingContainer.php | 164 +++++++++++++++ .../CompositeCachingServiceProvider.php | 147 +++++++++++++ .../Dhii/Container/CompositeContainer.php | 103 +++++++++ .../Container/DataStructureBasedFactory.php | 45 ++++ .../DataStructureBasedFactoryInterface.php | 27 +++ .../Dhii/Container/DelegatingContainer.php | 160 ++++++++++++++ .../Dhii/Container/DeprefixingContainer.php | 103 +++++++++ lib/packages/Dhii/Container/Dictionary.php | 139 +++++++++++++ .../Dhii/Container/DictionaryFactory.php | 22 ++ .../Exception/ContainerException.php | 33 +++ .../Container/Exception/NotFoundException.php | 24 +++ .../Dhii/Container/FlashContainer.php | 135 ++++++++++++ .../Dhii/Container/HierarchyContainer.php | 93 +++++++++ .../Dhii/Container/MappingContainer.php | 90 ++++++++ .../Dhii/Container/MaskingContainer.php | 101 +++++++++ lib/packages/Dhii/Container/NoOpContainer.php | 99 +++++++++ lib/packages/Dhii/Container/PathContainer.php | 143 +++++++++++++ .../Dhii/Container/PrefixingContainer.php | 128 ++++++++++++ .../Dhii/Container/ProxyContainer.php | 71 +++++++ .../Dhii/Container/SegmentingContainer.php | 119 +++++++++++ .../Dhii/Container/ServiceProvider.php | 50 +++++ .../Dhii/Container/SimpleCacheContainer.php | 111 ++++++++++ .../Container/Util/StringTranslatingTrait.php | 52 +++++ .../Exception/ModuleExceptionInterface.php | 19 ++ .../Modular/Module/ModuleAwareInterface.php | 22 ++ .../Dhii/Modular/Module/ModuleInterface.php | 54 +++++ .../Container/ServiceProviderInterface.php | 41 ++++ .../Container/ContainerExceptionInterface.php | 12 ++ .../Psr/Container/ContainerInterface.php | 36 ++++ .../Container/NotFoundExceptionInterface.php | 10 + modules/ppcp-admin-notices/module.php | 2 +- modules/ppcp-admin-notices/services.php | 2 +- .../ppcp-admin-notices/src/AdminNotices.php | 8 +- modules/ppcp-api-client/module.php | 2 +- modules/ppcp-api-client/services.php | 2 +- modules/ppcp-api-client/src/ApiModule.php | 8 +- .../src/Exception/NotFoundException.php | 2 +- .../ApplicationContextRepository.php | 2 +- modules/ppcp-button/module.php | 2 +- modules/ppcp-button/services.php | 2 +- modules/ppcp-button/src/ButtonModule.php | 8 +- modules/ppcp-compat/module.php | 2 +- modules/ppcp-compat/services.php | 2 +- modules/ppcp-compat/src/CompatModule.php | 8 +- modules/ppcp-onboarding/module.php | 2 +- modules/ppcp-onboarding/services.php | 2 +- modules/ppcp-onboarding/src/Environment.php | 2 +- .../ppcp-onboarding/src/OnboardingModule.php | 8 +- .../src/OnboardingRESTController.php | 2 +- modules/ppcp-onboarding/src/State.php | 2 +- modules/ppcp-order-tracking/carriers.php | 2 +- modules/ppcp-order-tracking/module.php | 2 +- modules/ppcp-order-tracking/services.php | 2 +- .../src/OrderTrackingModule.php | 8 +- modules/ppcp-session/module.php | 2 +- modules/ppcp-session/services.php | 2 +- .../src/Cancellation/CancelView.php | 2 +- modules/ppcp-session/src/SessionModule.php | 8 +- modules/ppcp-status-report/module.php | 2 +- .../src/StatusReportModule.php | 8 +- modules/ppcp-subscription/module.php | 2 +- modules/ppcp-subscription/services.php | 2 +- .../src/SubscriptionModule.php | 8 +- modules/ppcp-vaulting/module.php | 2 +- modules/ppcp-vaulting/services.php | 2 +- .../src/VaultedCreditCardHandler.php | 2 +- modules/ppcp-vaulting/src/VaultingModule.php | 8 +- .../connection-tab-settings.php | 2 +- modules/ppcp-wc-gateway/extensions.php | 2 +- modules/ppcp-wc-gateway/module.php | 2 +- modules/ppcp-wc-gateway/services.php | 2 +- .../src/Checkout/DisableGateways.php | 2 +- .../src/Exception/NotFoundException.php | 2 +- .../FundingSource/FundingSourceRenderer.php | 2 +- .../src/Gateway/CardButtonGateway.php | 2 +- .../src/Gateway/CreditCardGateway.php | 2 +- .../src/Gateway/PayPalGateway.php | 2 +- .../src/Notice/ConnectAdminNotice.php | 2 +- .../GatewayWithoutPayPalAdminNotice.php | 2 +- .../Processor/AuthorizedPaymentsProcessor.php | 2 +- .../ppcp-wc-gateway/src/Settings/Settings.php | 2 +- .../src/Settings/SettingsRenderer.php | 2 +- .../ppcp-wc-gateway/src/WCGatewayModule.php | 8 +- modules/ppcp-webhooks/module.php | 2 +- modules/ppcp-webhooks/services.php | 2 +- modules/ppcp-webhooks/src/WebhookModule.php | 8 +- modules/woocommerce-logging/module.php | 2 +- modules/woocommerce-logging/services.php | 2 +- .../src/WooCommerceLoggingModule.php | 8 +- src/PluginModule.php | 8 +- src/services.php | 2 +- tests/PHPUnit/ModularTestCase.php | 8 +- .../Subscription/RenewalHandlerTest.php | 2 +- .../Vaulting/VaultedCreditCardHandlerTest.php | 2 +- .../Gateway/CreditCardGatewayTest.php | 2 +- .../AuthorizedPaymentsProcessorTest.php | 2 +- .../Processor/OrderProcessorTest.php | 2 +- .../ApplicationContextRepositoryTest.php | 2 +- tests/e2e/PHPUnit/TestCase.php | 2 +- 123 files changed, 3227 insertions(+), 188 deletions(-) create mode 100644 lib/README.md create mode 100644 lib/packages/Dhii/Collection/ClearableContainerInterface.php create mode 100644 lib/packages/Dhii/Collection/ContainerFactoryInterface.php create mode 100644 lib/packages/Dhii/Collection/ContainerInterface.php create mode 100644 lib/packages/Dhii/Collection/CountableListInterface.php create mode 100644 lib/packages/Dhii/Collection/CountableMapInterface.php create mode 100644 lib/packages/Dhii/Collection/CountableSetInterface.php create mode 100644 lib/packages/Dhii/Collection/HasCapableInterface.php create mode 100644 lib/packages/Dhii/Collection/HasItemCapableInterface.php create mode 100644 lib/packages/Dhii/Collection/MapFactoryInterface.php create mode 100644 lib/packages/Dhii/Collection/MapInterface.php create mode 100644 lib/packages/Dhii/Collection/MutableContainerInterface.php create mode 100644 lib/packages/Dhii/Collection/SetFactoryInterface.php create mode 100644 lib/packages/Dhii/Collection/SetInterface.php create mode 100644 lib/packages/Dhii/Collection/WritableContainerFactoryInterface.php create mode 100644 lib/packages/Dhii/Collection/WritableContainerInterface.php create mode 100644 lib/packages/Dhii/Collection/WritableMapFactoryInterface.php create mode 100644 lib/packages/Dhii/Collection/WritableMapInterface.php create mode 100644 lib/packages/Dhii/Collection/WritableSetFactoryInterface.php create mode 100644 lib/packages/Dhii/Collection/WritableSetInterface.php create mode 100644 lib/packages/Dhii/Container/AliasingContainer.php create mode 100644 lib/packages/Dhii/Container/CachingContainer.php create mode 100644 lib/packages/Dhii/Container/CompositeCachingServiceProvider.php create mode 100644 lib/packages/Dhii/Container/CompositeContainer.php create mode 100644 lib/packages/Dhii/Container/DataStructureBasedFactory.php create mode 100644 lib/packages/Dhii/Container/DataStructureBasedFactoryInterface.php create mode 100644 lib/packages/Dhii/Container/DelegatingContainer.php create mode 100644 lib/packages/Dhii/Container/DeprefixingContainer.php create mode 100644 lib/packages/Dhii/Container/Dictionary.php create mode 100644 lib/packages/Dhii/Container/DictionaryFactory.php create mode 100644 lib/packages/Dhii/Container/Exception/ContainerException.php create mode 100644 lib/packages/Dhii/Container/Exception/NotFoundException.php create mode 100644 lib/packages/Dhii/Container/FlashContainer.php create mode 100644 lib/packages/Dhii/Container/HierarchyContainer.php create mode 100644 lib/packages/Dhii/Container/MappingContainer.php create mode 100644 lib/packages/Dhii/Container/MaskingContainer.php create mode 100644 lib/packages/Dhii/Container/NoOpContainer.php create mode 100644 lib/packages/Dhii/Container/PathContainer.php create mode 100644 lib/packages/Dhii/Container/PrefixingContainer.php create mode 100644 lib/packages/Dhii/Container/ProxyContainer.php create mode 100644 lib/packages/Dhii/Container/SegmentingContainer.php create mode 100644 lib/packages/Dhii/Container/ServiceProvider.php create mode 100644 lib/packages/Dhii/Container/SimpleCacheContainer.php create mode 100644 lib/packages/Dhii/Container/Util/StringTranslatingTrait.php create mode 100644 lib/packages/Dhii/Modular/Module/Exception/ModuleExceptionInterface.php create mode 100644 lib/packages/Dhii/Modular/Module/ModuleAwareInterface.php create mode 100644 lib/packages/Dhii/Modular/Module/ModuleInterface.php create mode 100644 lib/packages/Interop/Container/ServiceProviderInterface.php create mode 100644 lib/packages/Psr/Container/ContainerExceptionInterface.php create mode 100644 lib/packages/Psr/Container/ContainerInterface.php create mode 100644 lib/packages/Psr/Container/NotFoundExceptionInterface.php diff --git a/bootstrap.php b/bootstrap.php index 8d9cbef15..27c8f36a3 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -5,14 +5,14 @@ * @package WooCommerce\PayPalCommerce */ -use Dhii\Container\CachingContainer; -use Dhii\Container\CompositeCachingServiceProvider; -use Dhii\Container\CompositeContainer; -use Dhii\Container\DelegatingContainer; -use Dhii\Container\ProxyContainer; -use Dhii\Modular\Module\ModuleInterface; -use Interop\Container\ServiceProviderInterface; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\CachingContainer; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\CompositeCachingServiceProvider; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\CompositeContainer; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\DelegatingContainer; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ProxyContainer; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface; +use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; return function ( string $root_dir, diff --git a/composer.json b/composer.json index 4649de979..0a2509eb2 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,6 @@ "php": "^7.1 | ^8.0", "ext-json": "*", "dhii/module-interface": "^0.2 || ^0.3", - "psr/container": "^1.0", "container-interop/service-provider": "^0.4.0", "dhii/containers": "^0.1.0-alpha1", "psr/log": "^1.1", @@ -18,6 +17,7 @@ "symfony/polyfill-php80": "^1.19" }, "require-dev": { + "psr/container": "^1.0", "woocommerce/woocommerce-sniffs": "^0.1.0", "phpunit/phpunit": "^7.0 | ^8.0 | ^9.0", "brain/monkey": "^2.4", @@ -28,7 +28,8 @@ }, "autoload": { "psr-4": { - "WooCommerce\\PayPalCommerce\\": "src" + "WooCommerce\\PayPalCommerce\\": "src", + "WooCommerce\\PayPalCommerce\\Vendor\\": "lib/packages/" } }, "autoload-dev": { @@ -63,6 +64,18 @@ "pre-commit": [ "vendor/bin/phpcbf" ] + }, + "mozart": { + "dep_namespace": "WooCommerce\\PayPalCommerce\\Vendor\\", + "dep_directory": "/lib/packages/", + "classmap_directory": "/lib/classes/", + "classmap_prefix": "PCPP_", + "packages": [ + "psr/container", + "dhii/containers", + "dhii/module-interface" + ], + "delete_vendor_directories": true } } } diff --git a/composer.lock b/composer.lock index d8fe60d77..50d402a39 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c556381af92720a1f7c3cd0795c2653a", + "content-hash": "2b16b39502bcfa86aaf9a9a53d78b187", "packages": [ { "name": "container-interop/service-provider", @@ -1601,16 +1601,16 @@ }, { "name": "mockery/mockery", - "version": "1.3.5", + "version": "1.3.6", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "472fa8ca4e55483d55ee1e73c963718c4393791d" + "reference": "dc206df4fa314a50bbb81cf72239a305c5bbd5c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/472fa8ca4e55483d55ee1e73c963718c4393791d", - "reference": "472fa8ca4e55483d55ee1e73c963718c4393791d", + "url": "https://api.github.com/repos/mockery/mockery/zipball/dc206df4fa314a50bbb81cf72239a305c5bbd5c0", + "reference": "dc206df4fa314a50bbb81cf72239a305c5bbd5c0", "shasum": "" }, "require": { @@ -1662,7 +1662,7 @@ "test double", "testing" ], - "time": "2021-09-13T15:33:03+00:00" + "time": "2022-09-07T15:05:49+00:00" }, { "name": "myclabs/deep-copy", @@ -1767,16 +1767,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.14.0", + "version": "v4.15.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1" + "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/34bea19b6e03d8153165d8f30bba4c3be86184c1", - "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", + "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", "shasum": "" }, "require": { @@ -1815,7 +1815,7 @@ "parser", "php" ], - "time": "2022-05-31T20:59:12+00:00" + "time": "2022-09-04T07:30:47+00:00" }, { "name": "openlss/lib-array2xml", @@ -2010,16 +2010,16 @@ }, { "name": "php-stubs/wordpress-stubs", - "version": "v5.9.3", + "version": "v5.9.4", "source": { "type": "git", "url": "https://github.com/php-stubs/wordpress-stubs.git", - "reference": "18d56875e5078a50b8ea4bc4b20b735ca61edeee" + "reference": "3e481f4c8195fb3ca9e3e4e52e5305bf59c74cdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/18d56875e5078a50b8ea4bc4b20b735ca61edeee", - "reference": "18d56875e5078a50b8ea4bc4b20b735ca61edeee", + "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/3e481f4c8195fb3ca9e3e4e52e5305bf59c74cdb", + "reference": "3e481f4c8195fb3ca9e3e4e52e5305bf59c74cdb", "shasum": "" }, "replace": { @@ -2049,7 +2049,7 @@ "static analysis", "wordpress" ], - "time": "2022-04-06T15:33:59+00:00" + "time": "2022-09-30T17:45:35+00:00" }, { "name": "phpcompatibility/php-compatibility", @@ -2111,16 +2111,16 @@ }, { "name": "phpcompatibility/phpcompatibility-paragonie", - "version": "1.3.1", + "version": "1.3.2", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git", - "reference": "ddabec839cc003651f2ce695c938686d1086cf43" + "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/ddabec839cc003651f2ce695c938686d1086cf43", - "reference": "ddabec839cc003651f2ce695c938686d1086cf43", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/bba5a9dfec7fcfbd679cfaf611d86b4d3759da26", + "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26", "shasum": "" }, "require": { @@ -2157,22 +2157,23 @@ "paragonie", "phpcs", "polyfill", - "standards" + "standards", + "static analysis" ], - "time": "2021-02-15T10:24:51+00:00" + "time": "2022-10-25T01:46:02+00:00" }, { "name": "phpcompatibility/phpcompatibility-wp", - "version": "2.1.3", + "version": "2.1.4", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", - "reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308" + "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/d55de55f88697b9cdb94bccf04f14eb3b11cf308", - "reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", + "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", "shasum": "" }, "require": { @@ -2207,9 +2208,10 @@ "compatibility", "phpcs", "standards", + "static analysis", "wordpress" ], - "time": "2021-12-30T16:37:40+00:00" + "time": "2022-10-24T09:00:36+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -2696,6 +2698,12 @@ "keywords": [ "timer" ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], "time": "2020-11-30T08:20:02+00:00" }, { @@ -2745,6 +2753,12 @@ "keywords": [ "tokenizer" ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], "abandoned": true, "time": "2021-07-26T12:15:06+00:00" }, @@ -2875,20 +2889,26 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], "time": "2020-11-30T08:15:22+00:00" }, { "name": "sebastian/comparator", - "version": "3.0.3", + "version": "3.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1071dfcef776a57013124ff35e1fc41ccd294758" + "reference": "1dc7ceb4a24aede938c7af2a9ed1de09609ca770" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1071dfcef776a57013124ff35e1fc41ccd294758", - "reference": "1071dfcef776a57013124ff35e1fc41ccd294758", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dc7ceb4a24aede938c7af2a9ed1de09609ca770", + "reference": "1dc7ceb4a24aede938c7af2a9ed1de09609ca770", "shasum": "" }, "require": { @@ -2939,7 +2959,13 @@ "compare", "equality" ], - "time": "2020-11-30T08:04:30+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-14T12:31:48+00:00" }, { "name": "sebastian/diff", @@ -2995,6 +3021,12 @@ "unidiff", "unified diff" ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], "time": "2020-11-30T07:59:04+00:00" }, { @@ -3048,20 +3080,26 @@ "environment", "hhvm" ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], "time": "2020-11-30T07:53:42+00:00" }, { "name": "sebastian/exporter", - "version": "3.1.4", + "version": "3.1.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db" + "reference": "73a9676f2833b9a7c36968f9d882589cd75511e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", - "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/73a9676f2833b9a7c36968f9d882589cd75511e6", + "reference": "73a9676f2833b9a7c36968f9d882589cd75511e6", "shasum": "" }, "require": { @@ -3121,7 +3159,7 @@ "type": "github" } ], - "time": "2021-11-11T13:51:24+00:00" + "time": "2022-09-14T06:00:17+00:00" }, { "name": "sebastian/global-state", @@ -3219,6 +3257,12 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], "time": "2020-11-30T07:40:27+00:00" }, { @@ -3264,6 +3308,12 @@ ], "description": "Allows reflection of object attributes, including inherited and non-public ones", "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], "time": "2020-11-30T07:37:18+00:00" }, { @@ -3317,6 +3367,12 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], "time": "2020-11-30T07:34:24+00:00" }, { @@ -3359,6 +3415,12 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], "time": "2020-11-30T07:30:19+00:00" }, { @@ -3406,16 +3468,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.7.0", + "version": "3.7.1", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "a2cd51b45bcaef9c1f2a4bda48f2dd2fa2b95563" + "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/a2cd51b45bcaef9c1f2a4bda48f2dd2fa2b95563", - "reference": "a2cd51b45bcaef9c1f2a4bda48f2dd2fa2b95563", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619", + "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619", "shasum": "" }, "require": { @@ -3453,20 +3515,20 @@ "phpcs", "standards" ], - "time": "2022-06-13T06:31:38+00:00" + "time": "2022-06-18T07:21:10+00:00" }, { "name": "symfony/console", - "version": "v4.4.42", + "version": "v4.4.48", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "cce7a9f99e22937a71a16b23afa762558808d587" + "reference": "8e70c1cab07ac641b885ce80385b9824a293c623" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/cce7a9f99e22937a71a16b23afa762558808d587", - "reference": "cce7a9f99e22937a71a16b23afa762558808d587", + "url": "https://api.github.com/repos/symfony/console/zipball/8e70c1cab07ac641b885ce80385b9824a293c623", + "reference": "8e70c1cab07ac641b885ce80385b9824a293c623", "shasum": "" }, "require": { @@ -3540,7 +3602,7 @@ "type": "tidelift" } ], - "time": "2022-05-14T12:35:33+00:00" + "time": "2022-10-26T16:02:45+00:00" }, { "name": "symfony/polyfill-ctype", @@ -3779,16 +3841,16 @@ }, { "name": "symfony/service-contracts", - "version": "v1.1.12", + "version": "v1.1.13", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "eedb374f02031714a48848758a27812f3eca317a" + "reference": "afa00c500c2d6aea6e3b2f4862355f507bc5ebb4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/eedb374f02031714a48848758a27812f3eca317a", - "reference": "eedb374f02031714a48848758a27812f3eca317a", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/afa00c500c2d6aea6e3b2f4862355f507bc5ebb4", + "reference": "afa00c500c2d6aea6e3b2f4862355f507bc5ebb4", "shasum": "" }, "require": { @@ -3851,7 +3913,7 @@ "type": "tidelift" } ], - "time": "2022-03-09T13:39:03+00:00" + "time": "2022-05-27T14:01:05+00:00" }, { "name": "theseer/tokenizer", @@ -3895,16 +3957,16 @@ }, { "name": "vimeo/psalm", - "version": "4.23.0", + "version": "4.30.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "f1fe6ff483bf325c803df9f510d09a03fd796f88" + "reference": "d0bc6e25d89f649e4f36a534f330f8bb4643dd69" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/f1fe6ff483bf325c803df9f510d09a03fd796f88", - "reference": "f1fe6ff483bf325c803df9f510d09a03fd796f88", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/d0bc6e25d89f649e4f36a534f330f8bb4643dd69", + "reference": "d0bc6e25d89f649e4f36a534f330f8bb4643dd69", "shasum": "" }, "require": { @@ -3943,6 +4005,7 @@ "phpdocumentor/reflection-docblock": "^5", "phpmyadmin/sql-parser": "5.1.0||dev-master", "phpspec/prophecy": ">=1.9.0", + "phpstan/phpdoc-parser": "1.2.* || 1.6.4", "phpunit/phpunit": "^9.0", "psalm/plugin-phpunit": "^0.16", "slevomat/coding-standard": "^7.0", @@ -3994,20 +4057,20 @@ "inspection", "php" ], - "time": "2022-04-28T17:35:49+00:00" + "time": "2022-11-06T20:37:08+00:00" }, { "name": "vlucas/phpdotenv", - "version": "v5.4.1", + "version": "v5.5.0", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "264dce589e7ce37a7ba99cb901eed8249fbec92f" + "reference": "1a7ea2afc49c3ee6d87061f5a233e3a035d0eae7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/264dce589e7ce37a7ba99cb901eed8249fbec92f", - "reference": "264dce589e7ce37a7ba99cb901eed8249fbec92f", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/1a7ea2afc49c3ee6d87061f5a233e3a035d0eae7", + "reference": "1a7ea2afc49c3ee6d87061f5a233e3a035d0eae7", "shasum": "" }, "require": { @@ -4022,15 +4085,19 @@ "require-dev": { "bamarni/composer-bin-plugin": "^1.4.1", "ext-filter": "*", - "phpunit/phpunit": "^7.5.20 || ^8.5.21 || ^9.5.10" + "phpunit/phpunit": "^7.5.20 || ^8.5.30 || ^9.5.25" }, "suggest": { "ext-filter": "Required to use the boolean validator." }, "type": "library", "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": true + }, "branch-alias": { - "dev-master": "5.4-dev" + "dev-master": "5.5-dev" } }, "autoload": { @@ -4070,7 +4137,7 @@ "type": "tidelift" } ], - "time": "2021-12-12T23:22:04+00:00" + "time": "2022-10-16T01:01:54+00:00" }, { "name": "webmozart/assert", diff --git a/lib/README.md b/lib/README.md new file mode 100644 index 000000000..9114c43ef --- /dev/null +++ b/lib/README.md @@ -0,0 +1,5 @@ +The packages that are likely to cause conflicts with other plugins (by loading multiple incompatible versions). +Their namespaces are isolated by [Mozart](https://github.com/coenjacobs/mozart). + +Currently, the packages are simply added in the repo to avoid making the build process more complex (Mozart has different PHP requirements). +We need to isolate only PSR-11 containers and Dhii modularity packages, which are not supposed to change often. diff --git a/lib/packages/Dhii/Collection/ClearableContainerInterface.php b/lib/packages/Dhii/Collection/ClearableContainerInterface.php new file mode 100644 index 000000000..0cb636b8f --- /dev/null +++ b/lib/packages/Dhii/Collection/ClearableContainerInterface.php @@ -0,0 +1,19 @@ + $data The data for the container. + * + * @return ContainerInterface The new container. + * + * @throws Exception If problem creating. + * + * @psalm-suppress PossiblyUnusedMethod + */ + public function createContainerFromArray(array $data): ContainerInterface; +} diff --git a/lib/packages/Dhii/Collection/ContainerInterface.php b/lib/packages/Dhii/Collection/ContainerInterface.php new file mode 100644 index 000000000..45055a2ec --- /dev/null +++ b/lib/packages/Dhii/Collection/ContainerInterface.php @@ -0,0 +1,16 @@ + $data The data to base the map on. + * + * @return MapInterface The new map. + * + * @throws Exception If problem creating. + */ + public function createContainerFromArray(array $data): BaseContainerInterface; +} diff --git a/lib/packages/Dhii/Collection/MapInterface.php b/lib/packages/Dhii/Collection/MapInterface.php new file mode 100644 index 000000000..22937b0b4 --- /dev/null +++ b/lib/packages/Dhii/Collection/MapInterface.php @@ -0,0 +1,21 @@ + $list The list to base the set on. + * + * @return SetInterface The new set. + * + * @throws Exception If problem creating. + * + * @psalm-suppress PossiblyUnusedMethod + */ + public function createSetFromList(array $list): SetInterface; +} diff --git a/lib/packages/Dhii/Collection/SetInterface.php b/lib/packages/Dhii/Collection/SetInterface.php new file mode 100644 index 000000000..827f112c4 --- /dev/null +++ b/lib/packages/Dhii/Collection/SetInterface.php @@ -0,0 +1,21 @@ + $mappings A map of keys to values. + * + * @return static A new instance of this class with only the specified key-value mappings. + * + * @throws Exception If problem creating. + * + * @psalm-suppress PossiblyUnusedMethod + */ + public function withMappings(array $mappings): WritableContainerInterface; + + /** + * Creates a new instance with the specified mappings added to existing ones. + * + * @since [*next-version*] + * + * @param array $mappings A map of keys to values. + * + * @return static A new instance of this class with the specified key-value mappings added to existing ones. + * + * @throws Exception If problem creating. + * + * @psalm-suppress PossiblyUnusedMethod + */ + public function withAddedMappings(array $mappings): WritableContainerInterface; + + /** + * Creates a new instance with the specified keys not present. + * + * @since [*next-version*] + * + * @param array $keys The keys to exclude. + * + * @return static A new instance of this class which does not contain the specified keys. + * + * @throws Exception If problem instantiating. + * + * @psalm-suppress PossiblyUnusedMethod + */ + public function withoutKeys(array $keys): WritableContainerInterface; +} diff --git a/lib/packages/Dhii/Collection/WritableMapFactoryInterface.php b/lib/packages/Dhii/Collection/WritableMapFactoryInterface.php new file mode 100644 index 000000000..ae583f040 --- /dev/null +++ b/lib/packages/Dhii/Collection/WritableMapFactoryInterface.php @@ -0,0 +1,22 @@ + + */ + protected $aliases; + + /** + * Constructor. + * + * @since [*next-version*] + * + * @param PsrContainerInterface $inner The container whose keys to alias. + * @param array $aliases A mapping of aliases to their original container key counterparts. + */ + public function __construct(PsrContainerInterface $inner, array $aliases) + { + $this->inner = $inner; + $this->aliases = $aliases; + } + + /** + * @inheritdoc + * + * @since [*next-version*] + */ + public function get($key) + { + return $this->inner->get($this->getInnerKey($key)); + } + + /** + * @inheritdoc + * + * @since [*next-version*] + */ + public function has($key) + { + return $this->inner->has($this->getInnerKey($key)); + } + + /** + * Retrieves the key to use for the inner container. + * + * @since [*next-version*] + * + * @param string $key The outer key. + * + * @return string The inner key. + */ + protected function getInnerKey(string $key): string + { + if (array_key_exists($key, $this->aliases)) { + return $this->aliases[$key]; + } + + return $key; + } +} diff --git a/lib/packages/Dhii/Container/CachingContainer.php b/lib/packages/Dhii/Container/CachingContainer.php new file mode 100644 index 000000000..f62abacb9 --- /dev/null +++ b/lib/packages/Dhii/Container/CachingContainer.php @@ -0,0 +1,164 @@ + */ + protected $cache; + + /** @var PsrContainerInterface */ + protected $container; + + /** + * @param PsrContainerInterface $container The container to cache entries from. + */ + public function __construct(PsrContainerInterface $container) + { + $this->container = $container; + $this->cache = []; + } + + /** + * {@inheritDoc} + */ + public function get($key) + { + /** @psalm-suppress RedundantCastGivenDocblockType + * @psalm-suppress RedundantCast + * Will remove when switching to PHP 7.2 and new PSR-11 interfaces + */ + $key = (string) $key; + + /** + * @psalm-suppress InvalidCatch + * The base interface does not extend Throwable, but in fact everything that is possible + * in theory to catch will be Throwable, and PSR-11 exceptions will implement this interface + */ + try { + /** + * @psalm-suppress MissingClosureReturnType + * Unable to specify mixed before PHP 8. + */ + $value = $this->getCached($key, function () use ($key) { + return $this->container->get($key); + }); + } catch (NotFoundExceptionInterface $e) { + throw new NotFoundException($this->__('Key "%1$s" not found in inner container', [$key]), 0, $e); + } catch (Exception $e) { + throw new ContainerException( + $this->__('Could not retrieve value for key "%1$s from inner container', [$key]), + 0, + $e + ); + } + + return $value; + } + + /** + * {@inheritDoc} + */ + public function has($key) + { + /** @psalm-suppress RedundantCastGivenDocblockType + * Will remove when switching to PHP 7.2 and new PSR-11 interfaces + */ + $key = (string) $key; + + /** + * @psalm-suppress InvalidCatch + * The base interface does not extend Throwable, but in fact everything that is possible + * in theory to catch will be Throwable, and PSR-11 exceptions will implement this interface + */ + try { + if ($this->hasCached($key)) { + return true; + } + } catch (Exception $e) { + throw new ContainerException($this->__('Could not check cache for key "%1$s"', [$key]), 0, $e); + } + + try { + if ($this->container->has($key)) { + return true; + } + } catch (Exception $e) { + throw new ContainerException( + $this->__('Could not check inner container for key "%1$s"', [$key]), + 0, + $e + ); + } + + return false; + } + + /** + * Retrieves a value by key from cache, creating it if it does not exist. + * + * @param string $key The key to get. + * @param callable $generator Creates the value. + * + * @return mixed The cached value. + * + * @throws Exception If problem caching. + * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint + */ + protected function getCached(string $key, callable $generator) + { + if (!array_key_exists($key, $this->cache)) { + $value = $this->invokeGenerator($generator); + $this->cache[$key] = $value; + } + + return $this->cache[$key]; + } + + /** + * Checks the cache for the specified key. + * + * @param string $key The key to check for. + * + * @return bool True if cache contains the value; false otherwise. + * + * @throws Exception If problem checking. + */ + protected function hasCached(string $key): bool + { + return array_key_exists($key, $this->cache); + } + + /** + * Generates a value by invoking the generator. + * + * @param callable $generator Generates a value. + * + * @return mixed The generated result. + * + * @throws Exception If problem generating. + * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint + */ + protected function invokeGenerator(callable $generator) + { + $result = $generator(); + return $result; + } +} diff --git a/lib/packages/Dhii/Container/CompositeCachingServiceProvider.php b/lib/packages/Dhii/Container/CompositeCachingServiceProvider.php new file mode 100644 index 000000000..13bbb38f3 --- /dev/null +++ b/lib/packages/Dhii/Container/CompositeCachingServiceProvider.php @@ -0,0 +1,147 @@ + + */ + protected $providers; + + /** + * @var ?iterable + */ + protected $factories; + + /** + * @var ?iterable + */ + protected $extensions; + + /** + * @param iterable $providers + */ + public function __construct(iterable $providers) + { + $this->providers = $providers; + $this->factories = null; + $this->extensions = null; + } + + /** + * {@inheritDoc} + * @psalm-suppress InvalidNullableReturnType + * It isn't actually going to return null ever, because $factories will be filled during indexing. + */ + public function getFactories() + { + if (!is_array($this->factories)) { + $this->indexProviderDefinitions($this->providers); + } + + /** + * @psalm-suppress NullableReturnStatement + * Not going to be null because will be populated by indexing + */ + return $this->factories; + } + + /** + * {@inheritDoc} + * @psalm-suppress InvalidNullableReturnType + * It isn't actually going to return null ever, because $factories will be filled during indexing. + */ + public function getExtensions() + { + if (!is_array($this->extensions)) { + $this->indexProviderDefinitions($this->providers); + } + + /** + * @psalm-suppress NullableReturnStatement + * Not going to be null because will be populated by indexing + */ + return $this->extensions; + } + + /** + * Indexes definitions in the specified service providers. + * + * Caches them internally. + * + * @param iterable|ServiceProviderInterface[] $providers The providers to index. + */ + protected function indexProviderDefinitions(iterable $providers): void + { + $factories = []; + $extensions = []; + + foreach ($providers as $provider) { + $factories = $this->mergeFactories($factories, $provider->getFactories()); + $extensions = $this->mergeExtensions($extensions, $provider->getExtensions()); + } + + $this->factories = $factories; + $this->extensions = $extensions; + } + + /** + * Merges two maps of factories. + * + * @param callable[] $defaults The factory map to merge into. + * @param callable[] $definitions The factory map to merge. Values from here will override defaults. + * + * @return callable[] The merged factories. + */ + protected function mergeFactories(array $defaults, array $definitions): array + { + return array_merge($defaults, $definitions); + } + + /** + * Merged service extensions. + * + * @param callable[] $defaults + * @param iterable $extensions + * + * @return callable[] The merged extensions. + */ + protected function mergeExtensions(array $defaults, iterable $extensions): array + { + $merged = []; + + foreach ($extensions as $key => $extension) { + if (isset($defaults[$key])) { + $default = $defaults[$key]; + /** + * @psalm-suppress MissingClosureReturnType + * @psalm-suppress MissingClosureParamType + * Unable to specify mixed before PHP 8. + */ + $merged[$key] = function (PsrContainerInterface $c, $previous = null) use ($default, $extension) { + $result = $default($c, $previous); + $result = $extension($c, $result); + + return $result; + }; + + unset($defaults[$key]); + } else { + $merged[$key] = $extension; + } + } + + $merged = $this->mergeFactories($defaults, $merged); + + return $merged; + } +} diff --git a/lib/packages/Dhii/Container/CompositeContainer.php b/lib/packages/Dhii/Container/CompositeContainer.php new file mode 100644 index 000000000..6d68ee8c1 --- /dev/null +++ b/lib/packages/Dhii/Container/CompositeContainer.php @@ -0,0 +1,103 @@ + + */ + protected $containers; + + /** + * @param iterable $containers The list of containers. + */ + public function __construct(iterable $containers) + { + $this->containers = $containers; + } + + /** + * {@inheritDoc} + */ + public function get($key) + { + /** @psalm-suppress RedundantCastGivenDocblockType + * @psalm-suppress RedundantCast + * Will remove when switching to PHP 7.2 and new PSR-11 interfaces + */ + $key = (string) $key; + + foreach ($this->containers as $index => $container) { + /** + * @psalm-suppress InvalidCatch + * The base interface does not extend Throwable, but in fact everything that is possible + * in theory to catch will be Throwable, and PSR-11 exceptions will implement this interface + */ + try { + if ($container->has($key)) { + return $container->get($key); + } + } catch (NotFoundExceptionInterface $e) { + throw new NotFoundException( + $this->__('Failed to retrieve value for key "%1$s" from container at index "%2$s"', [$key, $index]), + 0, + $e + ); + } catch (Exception $e) { + throw new ContainerException( + $this->__('Failed check for key "%1$s" on container at index "%2$s"', [$key, $index]), + 0, + $e + ); + } + } + + throw new NotFoundException( + $this->__('Key "%1$s" not found in any of the containers', [$key]), + 0, + null + ); + } + + /** + * {@inheritDoc} + */ + public function has($key) + { + /** @psalm-suppress RedundantCastGivenDocblockType + * Will remove when switching to PHP 7.2 and new PSR-11 interfaces + */ + $key = (string) $key; + + foreach ($this->containers as $index => $container) { + try { + if ($container->has($key)) { + return true; + } + } catch (Exception $e) { + throw new ContainerException( + $this->__('Failed check for key "%1$s" on container at index "%2$s"', [$key, $index]), + 0, + $e + ); + } + } + + return false; + } +} diff --git a/lib/packages/Dhii/Container/DataStructureBasedFactory.php b/lib/packages/Dhii/Container/DataStructureBasedFactory.php new file mode 100644 index 000000000..c3489d407 --- /dev/null +++ b/lib/packages/Dhii/Container/DataStructureBasedFactory.php @@ -0,0 +1,45 @@ +containerFactory = $containerFactory; + } + + /** + * @inheritDoc + */ + public function createContainerFromArray(array $structure): ContainerInterface + { + $map = []; + foreach ($structure as $key => $value) { + if (is_object($value)) { + $value = get_object_vars($value); + } + + if (is_array($value)) { + $value = $this->createContainerFromArray($value); + } + + $map[$key] = $value; + } + + $container = $this->containerFactory->createContainerFromArray($map); + return $container; + } +} diff --git a/lib/packages/Dhii/Container/DataStructureBasedFactoryInterface.php b/lib/packages/Dhii/Container/DataStructureBasedFactoryInterface.php new file mode 100644 index 000000000..2381c1e02 --- /dev/null +++ b/lib/packages/Dhii/Container/DataStructureBasedFactoryInterface.php @@ -0,0 +1,27 @@ +provider = $provider; + $this->parent = $parent; + } + + /** + * {@inheritDoc} + */ + public function get($id) + { + $provider = $this->provider; + $services = $provider->getFactories(); + + if (!array_key_exists($id, $services)) { + throw new NotFoundException( + $this->__('Service not found for key "%1$s"', [$id]), + 0, + null + ); + } + + $service = $services[$id]; + + try { + $service = $this->invokeFactory($service); + } catch (UnexpectedValueException $e) { + throw new ContainerException( + $this->__('Could not create service "%1$s"', [$id]), + 0, + $e + ); + } + + $extensions = $provider->getExtensions(); + + if (!array_key_exists($id, $extensions)) { + return $service; + } + + $extension = $extensions[$id]; + + try { + $service = $this->invokeExtension($extension, $service); + } catch (UnexpectedValueException $e) { + throw new ContainerException( + $this->__('Could not extend service "%1$s"', [$id]), + 0, + $e + ); + } + + return $service; + } + + /** + * {@inheritDoc} + */ + public function has($id) + { + $services = $this->provider->getFactories(); + + return array_key_exists($id, $services); + } + + /** + * Retrieves a service by invoking its factory. + * + * @param callable $factory The factory to invoke. + * + * @return mixed The service created by the factory. + * + * @throws UnexpectedValueException If factory could not be invoked. + * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint + */ + protected function invokeFactory(callable $factory) + { + if (!is_callable($factory)) { + throw new UnexpectedValueException( + $this->__('Factory could not be invoked'), + 0, + null + ); + } + + $baseContainer = $this->getBaseContainer(); + $service = $factory($baseContainer); + + return $service; + } + + /** + * Extends the service by invoking the extension with it. + * + * @param callable $extension The extension to invoke. + * @param mixed $service The service to extend. + * + * @return mixed The extended service. + * + * @throws UnexpectedValueException If extension cannot be invoked. + * @phpcsSuppress SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint + */ + protected function invokeExtension(callable $extension, $service) + { + if (!is_callable($extension)) { + throw new UnexpectedValueException( + $this->__('Factory could not be invoked'), + 0, + null + ); + } + + $baseContainer = $this->getBaseContainer(); + $service = $extension($baseContainer, $service); + + return $service; + } + + /** + * Retrieves the container to be used for definitions and extensions. + * + * @return PsrContainerInterface The parent container, if set. Otherwise, this instance. + */ + protected function getBaseContainer(): PsrContainerInterface + { + return $this->parent instanceof PsrContainerInterface + ? $this->parent + : $this; + } +} diff --git a/lib/packages/Dhii/Container/DeprefixingContainer.php b/lib/packages/Dhii/Container/DeprefixingContainer.php new file mode 100644 index 000000000..8c6f14389 --- /dev/null +++ b/lib/packages/Dhii/Container/DeprefixingContainer.php @@ -0,0 +1,103 @@ +inner = $container; + $this->prefix = $prefix; + $this->strict = $strict; + } + + /** + * @inheritdoc + * + * @since [*next-version*] + */ + public function get($key) + { + /** + * @psalm-suppress InvalidCatch + * The base interface does not extend Throwable, but in fact everything that is possible + * in theory to catch will be Throwable, and PSR-11 exceptions will implement this interface + */ + try { + return $this->inner->get($this->getInnerKey($key)); + } catch (NotFoundExceptionInterface $nfException) { + if ($this->strict || !$this->inner->has($key)) { + throw $nfException; + } + } + + return $this->inner->get($key); + } + + /** + * @inheritdoc + * + * @since [*next-version*] + */ + public function has($key) + { + return $this->inner->has($this->getInnerKey($key)) || (!$this->strict && $this->inner->has($key)); + } + + /** + * Retrieves the key to use for the inner container. + * + * @since [*next-version*] + * + * @param string $key The outer key. + * + * @return string The inner key. + */ + protected function getInnerKey(string $key): string + { + return $this->prefix . $key; + } +} diff --git a/lib/packages/Dhii/Container/Dictionary.php b/lib/packages/Dhii/Container/Dictionary.php new file mode 100644 index 000000000..39560028b --- /dev/null +++ b/lib/packages/Dhii/Container/Dictionary.php @@ -0,0 +1,139 @@ + */ + protected $data; + + /** + * @param array $data The key-value map of data. + */ + public function __construct(array $data) + { + $this->data = $data; + } + + /** + * {@inheritDoc} + */ + public function get($key) + { + if (!array_key_exists($key, $this->data)) { + throw new NotFoundException( + $this->__('Dictionary does not have key "%1$s"', [$key]), + 0, + null + ); + } + + return $this->data[$key]; + } + + /** + * {@inheritDoc} + */ + public function has($key) + { + $isHas = array_key_exists($key, $this->data); + + return $isHas; + } + + /** + * {@inheritDoc} + */ + public function getIterator() + { + return new ArrayIterator($this->data); + } + + /** + * @inheritDoc + * @psalm-suppress MoreSpecificReturnType + * Psalm complains that the declared return type is more specific than inferred. + * This is not true, as it promises to return the interface. + */ + public function withMappings(array $mappings): WritableContainerInterface + { + $dictionary = $this->cloneMe(); + $dictionary->data = $mappings; + + /** + * @psalm-suppress LessSpecificReturnStatement + * Looks like this needs to be suppressed until able to hint return type `self`. + */ + return $dictionary; + } + + /** + * @inheritDoc + * @psalm-suppress MoreSpecificReturnType + * Psalm complains that the declared return type is more specific than inferred. + * This is not true, as it promises to return the interface. + */ + public function withAddedMappings(array $mappings): WritableContainerInterface + { + $dictionary = $this->cloneMe(); + $dictionary->data = $mappings + $this->data; + + /** + * @psalm-suppress LessSpecificReturnStatement + * Looks like this needs to be suppressed until able to hint return type `self`. + */ + return $dictionary; + } + + /** + * @inheritDoc + * @psalm-suppress MoreSpecificReturnType + * Psalm complains that the declared return type is more specific than inferred. + * This is not true, as it promises to return the interface. + */ + public function withoutKeys(array $keys): WritableContainerInterface + { + $dictionary = $this->cloneMe(); + + foreach ($keys as $i => $key) { + /** @psalm-suppress DocblockTypeContradiction Still want to enforce string */ + if (!is_string($key)) { + throw new RangeException($this->__('Key at index %1$d is not a string', [$i])); + } + unset($dictionary->data[$key]); + } + + /** + * @psalm-suppress LessSpecificReturnStatement + * Looks like this needs to be suppressed until able to hint return type `self`. + */ + return $dictionary; + } + + /** + * Creates a copy of this instance + * + * @return Dictionary The new instance + */ + protected function cloneMe(): Dictionary + { + return clone $this; + } +} diff --git a/lib/packages/Dhii/Container/DictionaryFactory.php b/lib/packages/Dhii/Container/DictionaryFactory.php new file mode 100644 index 000000000..b5b5562d8 --- /dev/null +++ b/lib/packages/Dhii/Container/DictionaryFactory.php @@ -0,0 +1,22 @@ + */ + protected $flashData = []; + + /** + * @param MutableContainerInterface $data The storage. + * @param string $dataKey The key to be used to store data in the storage. + */ + public function __construct(MutableContainerInterface $data, string $dataKey) + { + $this->data = $data; + $this->dataKey = $dataKey; + } + + /** + * Prepare storage before use. + * + * Should be called once before accessing data through this class. + * Will clear the data for the configured key from the storage. + */ + public function init(): void + { + $this->flashData = $this->data->has($this->dataKey) + ? $this->data->get($this->dataKey) + : []; + + $this->purgePersistentData(); + } + + /** + * @inheritDoc + */ + public function has($key) + { + return array_key_exists($key, $this->flashData); + } + + /** + * @inheritDoc + * + * Retrieves the value for the specified key from memory. + */ + public function get($key) + { + if (!array_key_exists($key, $this->flashData)) { + throw new NotFoundException(sprintf('Flash data not found for key "%1$s"', $key)); + } + + return $this->flashData[$key]; + } + + /** + * @inheritDoc + * + * Assigns the given value to the specified key in memory, and persists this change in storage. + */ + public function set(string $key, $value): void + { + $this->flashData[$key] = $value; + $this->persist($this->flashData); + } + + /** + * @inheritDoc + * + * Removes the specified key from memory, and persists this change in storage. + */ + public function unset(string $key): void + { + if (!array_key_exists($key, $this->flashData)) { + throw new NotFoundException(sprintf('Flash data not found for key "%1$s"', $key)); + } + + unset($this->flashData[$key]); + $this->persist($this->flashData); + } + + /** + * @inheritDoc + * + * Clears all of this instance's data from memory. + */ + public function clear(): void + { + $this->flashData = []; + $this->persist($this->flashData); + } + + /** + * Clear data from internal storage. + */ + protected function purgePersistentData(): void + { + $this->data->set($this->dataKey, []); + } + + /** + * Persist this instance's data from memory into storage. + * + * @param array $data The data to persist. + */ + protected function persist(array $data): void + { + $this->data->set($this->dataKey, $data); + } +} diff --git a/lib/packages/Dhii/Container/HierarchyContainer.php b/lib/packages/Dhii/Container/HierarchyContainer.php new file mode 100644 index 000000000..7c85b8f15 --- /dev/null +++ b/lib/packages/Dhii/Container/HierarchyContainer.php @@ -0,0 +1,93 @@ + [ + * 'db' => [ + * 'host' => 'localhost', + * 'port' => 3306, + * ], + * ] + * ]; + * + * $container = new HierarchicalContainer($data); + * $container->get('config')->get('db')->get('host'); // "localhost" + * ``` + * + * @since [*next-version*] + * @see PathContainer For an implementation that compliments this one by allowing container trees to be accessed using + * path-like keys. + * @see SegmentingContainer For an implementation that achieves a similar effect but for flat hierarchies. + */ +class HierarchyContainer implements ContainerInterface +{ + /** + * @since [*next-version*] + * + * @var mixed[] + */ + protected $data; + + /** + * Constructor. + * + * @since [*next-version*] + * + * @param mixed[] $data The hierarchical data for which to create the container tree. + */ + public function __construct(array $data) + { + $this->data = $data; + } + + /** + * @inheritDoc + * + * @since [*next-version*] + */ + public function get($key) + { + if (!array_key_exists($key, $this->data)) { + throw new NotFoundException("Key '{$key}' does not exist", 0, null); + } + + $value = $this->data[$key]; + + if ($value instanceof stdClass) { + $value = get_object_vars($value); + } + + if (is_array($value)) { + $value = $this->data[$key] = new self($value); + } + + return $value; + } + + /** + * @inheritDoc + * + * @since [*next-version*] + */ + public function has($key) + { + return array_key_exists($key, $this->data); + } +} diff --git a/lib/packages/Dhii/Container/MappingContainer.php b/lib/packages/Dhii/Container/MappingContainer.php new file mode 100644 index 000000000..10b21d52c --- /dev/null +++ b/lib/packages/Dhii/Container/MappingContainer.php @@ -0,0 +1,90 @@ + 'Paul', + * 'second' => 'JC', + * 'third' => 'Alex', + * ]); + * + * $mContainer = new MappingContainer($container, function ($name) { + * return $name . ' Denton'; + * }); + * + * $mContainer->get('first'); // "Paul Denton" + * $mContainer->get('second'); // "JC Denton" + * + * // We don't talk about Alex + * ``` + * + * @since [*next-version*] + */ +class MappingContainer implements ContainerInterface +{ + /* @since [*next-version*] */ + use StringTranslatingTrait; + + /** + * @since [*next-version*] + * + * @var callable + */ + protected $callback; + + /** + * @since [*next-version*] + * + * @var PsrContainerInterface + */ + protected $inner; + + /** + * Constructor. + * + * @since [*next-version*] + * + * @param PsrContainerInterface $inner The container instance to decorate. + * @param callable $callback The callback to invoke on get. It will be passed 3 parameters: + * * The inner container's value for the key being fetched. + * * The key being fetched. + * * A reference to this container instance. + */ + public function __construct(PsrContainerInterface $inner, callable $callback) + { + $this->callback = $callback; + $this->inner = $inner; + } + + /** + * @inheritdoc + * + * @since [*next-version*] + */ + public function get($key) + { + return ($this->callback)($this->inner->get($key), $key, $this); + } + + /** + * @inheritdoc + * + * @since [*next-version*] + */ + public function has($key) + { + return $this->inner->has($key); + } +} diff --git a/lib/packages/Dhii/Container/MaskingContainer.php b/lib/packages/Dhii/Container/MaskingContainer.php new file mode 100644 index 000000000..f2a721033 --- /dev/null +++ b/lib/packages/Dhii/Container/MaskingContainer.php @@ -0,0 +1,101 @@ +inner = $inner; + $this->defMask = $defaultMask; + $this->mask = $mask; + } + + /** + * @inheritdoc + * + * @since [*next-version*] + */ + public function get($key) + { + if (!$this->isExposed($key)) { + throw new NotFoundException( + $this->__('Inner key "%1$s" is not exposed', [$key]), + 0, + null + ); + } + + return $this->inner->get($key); + } + + /** + * @inheritdoc + * + * @since [*next-version*] + */ + public function has($key) + { + return $this->isExposed($key) && $this->inner->has($key); + } + + /** + * Checks if a key is exposed through the mask. + * + * @since [*next-version*] + * + * @param string $key The key to check. + * + * @return bool True if the key is exposed, false if the key is hidden. + */ + protected function isExposed(string $key): bool + { + return array_key_exists($key, $this->mask) + ? $this->mask[$key] !== false + : $this->defMask; + } +} diff --git a/lib/packages/Dhii/Container/NoOpContainer.php b/lib/packages/Dhii/Container/NoOpContainer.php new file mode 100644 index 000000000..143c4eb7f --- /dev/null +++ b/lib/packages/Dhii/Container/NoOpContainer.php @@ -0,0 +1,99 @@ + new Container([ + * 'db' => new Container([ + * 'host' => 'localhost', + * 'port' => 3306 + * ]) + * ]) + * ]); + * ``` + * + * A {@link PathContainer} can decorate the `$container` to substitute this: + * + * ```php + * $host = $container->get('config')->get('db')->get('port'); + * ``` + * + * With this: + * + * ```php + * $pContainer = new PathContainer($container, '.'); + * $pContainer->get('config.db.port'); + * ``` + * + * Note that this implementation DOES NOT create containers for hierarchical _values_. Each segment in a given path + * must correspond to a child {@link ContainerInterface} instance. + * + * @since [*next-version*] + * @see SegmentingContainer For an implementation that achieves the opposite effect. + */ +class PathContainer implements ContainerInterface +{ + /** + * @since [*next-version*] + * + * @var PsrContainerInterface + */ + protected $inner; + + /** + * @since [*next-version*] + * + * @var non-empty-string + */ + protected $delimiter; + + /** + * Constructor. + * + * @since [*next-version*] + * + * @param PsrContainerInterface $inner The container instance to decorate. + * @param non-empty-string $delimiter The path delimiter to use. + */ + public function __construct(PsrContainerInterface $inner, string $delimiter = '/') + { + $this->inner = $inner; + $this->delimiter = $delimiter; + } + + /** + * @inheritDoc + * + * @since [*next-version*] + */ + public function get($key) + { + $tKey = (strpos($key, $this->delimiter) === 0) + ? substr($key, strlen($this->delimiter)) + : $key; + + $delimiter = $this->delimiter; + if (!strlen($delimiter)) { + throw new ContainerException('Cannot use empty delimiter'); + } + + /** + * @psalm-suppress PossiblyFalseArgument + * Result of explode() will never be false, because delimiter is never empty - see above. + */ + $path = array_filter(explode($this->delimiter, $tKey)); + + if (empty($path)) { + throw new NotFoundException('The path is empty'); + } + + $current = $this->inner; + $head = $path[0]; + + while (!empty($path)) { + if (!($current instanceof PsrContainerInterface)) { + $tail = implode($this->delimiter, $path); + throw new NotFoundException(sprintf('Key "%1$s" does not exist at path "%2$s"', $head, $tail)); + } + + $head = array_shift($path); + $current = $current->get($head); + } + + return $current; + } + + /** + * @inheritDoc + * + * @since [*next-version*] + */ + public function has($key) + { + /** + * @psalm-suppress InvalidCatch + * The base interface does not extend Throwable, but in fact everything that is possible + * in theory to catch will be Throwable, and PSR-11 exceptions will implement this interface + */ + try { + $this->get($key); + + return true; + } catch (NotFoundExceptionInterface $exception) { + return false; + } + } +} diff --git a/lib/packages/Dhii/Container/PrefixingContainer.php b/lib/packages/Dhii/Container/PrefixingContainer.php new file mode 100644 index 000000000..f41afc226 --- /dev/null +++ b/lib/packages/Dhii/Container/PrefixingContainer.php @@ -0,0 +1,128 @@ +inner = $container; + $this->prefix = $prefix; + $this->strict = $strict; + } + + /** + * @inheritdoc + * + * @since [*next-version*] + */ + public function get($key) + { + if (!$this->isPrefixed($key) && $this->strict) { + throw new NotFoundException(sprintf('Key "%s" does not exist', $key)); + } + + /** + * @psalm-suppress InvalidCatch + * The base interface does not extend Throwable, but in fact everything that is possible + * in theory to catch will be Throwable, and PSR-11 exceptions will implement this interface + */ + try { + return $this->inner->get($this->unprefix($key)); + } catch (NotFoundExceptionInterface $nfException) { + if ($this->strict) { + throw $nfException; + } + } + + return $this->inner->get($key); + } + + /** + * @inheritdoc + * + * @since [*next-version*] + */ + public function has($key) + { + if (!$this->isPrefixed($key) && $this->strict) { + return false; + } + + return $this->inner->has($this->unprefix($key)) || (!$this->strict && $this->inner->has($key)); + } + + /** + * Retrieves the key to use for the inner container. + * + * @since [*next-version*] + * + * @param string $key The outer key. + * + * @return string The inner key. + */ + protected function unprefix(string $key): string + { + return $this->isPrefixed($key) + ? substr($key, strlen($this->prefix)) + : $key; + } + + /** + * Checks if the key is prefixed. + * + * @since [*next-version*] + * + * @param string $key The key to check. + * + * @return bool True if the key is prefixed, false if not. + */ + protected function isPrefixed(string $key): bool + { + return strlen($this->prefix) > 0 && strpos($key, $this->prefix) === 0; + } +} diff --git a/lib/packages/Dhii/Container/ProxyContainer.php b/lib/packages/Dhii/Container/ProxyContainer.php new file mode 100644 index 000000000..a6cbe1d99 --- /dev/null +++ b/lib/packages/Dhii/Container/ProxyContainer.php @@ -0,0 +1,71 @@ +innerContainer = $innerContainer; + } + + /** + * @inheritDoc + */ + public function get($key) + { + if (!($this->innerContainer instanceof BaseContainerInterface)) { + throw new ContainerException($this->__('Inner container not set')); + } + + return $this->innerContainer->get($key); + } + + /** + * @inheritDoc + */ + public function has($key) + { + if (!($this->innerContainer instanceof BaseContainerInterface)) { + /** @psalm-suppress MissingThrowsDocblock The exception class implements declared thrown interface */ + throw new ContainerException($this->__('Inner container not set')); + } + + return $this->innerContainer->has($key); + } + + /** + * Assigns an inner container tot his proxy. + * + * Calls to `has()` and `get()` will be forwarded to this inner container. + * + * @param BaseContainerInterface $innerContainer The inner container to proxy. + */ + public function setInnerContainer(BaseContainerInterface $innerContainer): void + { + $this->innerContainer = $innerContainer; + } +} diff --git a/lib/packages/Dhii/Container/SegmentingContainer.php b/lib/packages/Dhii/Container/SegmentingContainer.php new file mode 100644 index 000000000..27647605d --- /dev/null +++ b/lib/packages/Dhii/Container/SegmentingContainer.php @@ -0,0 +1,119 @@ + 'localhost', + * 'config.db.post' => '3306', + * ]; + * ``` + * + * A segmenting container can be created that provides access to the "host" and "port": + * + * ```php + * $segmented = new SegmentingContainer($container, '.'); + * $dbConfig = $config->get('config')->get('db'); + * $dbConfig->get("host"); // "localhost" + * $dbConfig->get("port"); // 3306 + * ``` + * + * @since [*next-version*] + * @see PathContainer For an implementation that achieves the opposite effect. + */ +class SegmentingContainer implements ContainerInterface +{ + /** + * @var PsrContainerInterface + */ + protected $inner; + + /** + * @var string + */ + protected $root; + + /** + * @var string + */ + protected $delimiter; + + /** + * Constructor. + * + * @since [*next-version*] + * + * @param PsrContainerInterface $inner The container to decorate. + * @param string $delimiter The path delimiter. + */ + public function __construct(PsrContainerInterface $inner, string $delimiter = '/') + { + $this->inner = $inner; + $this->root = ''; + $this->delimiter = $delimiter; + } + + /** + * @inheritdoc + * + * @since [*next-version*] + */ + public function get($key) + { + $tKey = ltrim($key, $this->delimiter); + $tRoot = rtrim($this->root, $this->delimiter); + // Implode to glue together the key and root, and array_filter to ignore them if they're empty + $fullKey = implode($this->delimiter, array_filter([$tRoot, $tKey])); + + if ($this->inner->has($fullKey)) { + return $this->inner->get($fullKey); + } + + $instance = clone $this; + $instance->root = $fullKey; + + return $instance; + } + + /** + * @inheritdoc + * + * @since [*next-version*] + */ + public function has($key) + { + return $this->inner->has($key); + } +} diff --git a/lib/packages/Dhii/Container/ServiceProvider.php b/lib/packages/Dhii/Container/ServiceProvider.php new file mode 100644 index 000000000..39dc8d012 --- /dev/null +++ b/lib/packages/Dhii/Container/ServiceProvider.php @@ -0,0 +1,50 @@ +factories = $factories; + $this->extensions = $extensions; + } + + /** + * {@inheritDoc} + */ + public function getFactories() + { + return $this->factories; + } + + /** + * {@inheritDoc} + */ + public function getExtensions() + { + return $this->extensions; + } +} diff --git a/lib/packages/Dhii/Container/SimpleCacheContainer.php b/lib/packages/Dhii/Container/SimpleCacheContainer.php new file mode 100644 index 000000000..eba8e29bb --- /dev/null +++ b/lib/packages/Dhii/Container/SimpleCacheContainer.php @@ -0,0 +1,111 @@ +storage = $storage; + $this->ttl = $ttl; + } + + /** + * @inheritDoc + */ + public function get($id) + { + $storage = $this->storage; + + try { + if (!$storage->has($id)) { + return new NotFoundException(sprintf('Key "%1$s" not found', $id)); + } + + $value = $storage->get($id); + } catch (Exception $e) { + throw new ContainerException(sprintf('Could not retrieve value for key "%1$s"', $id), 0, $e); + } + + return $value; + } + + /** + * @inheritDoc + */ + public function has($id) + { + $storage = $this->storage; + + try { + $has = $storage->has($id); + } catch (Exception $e) { + throw new ContainerException(sprintf('Could not check for key "%1$s"', $id), 0, $e); + } + + return $has; + } + + /** + * @inheritDoc + */ + public function set(string $key, $value): void + { + $storage = $this->storage; + $ttl = $this->ttl; + + try { + $storage->set($key, $value, $ttl); + } catch (Exception $e) { + throw new ContainerException(sprintf('Could not set key "%1$s" with value "%2$s"', $key, $value), 0, $e); + } + } + + /** + * @inheritDoc + */ + public function unset(string $key): void + { + $storage = $this->storage; + + try { + $storage->delete($key); + } catch (Exception $e) { + throw new ContainerException(sprintf('Could not unset key "%1$s"', $key), 0, $e); + } + } + + /** + * @inheritDoc + */ + public function clear(): void + { + $storage = $this->storage; + + try { + $storage->clear(); + } catch (Exception $e) { + throw new ContainerException(sprintf('Could not clear container'), 0, $e); + } + } +} diff --git a/lib/packages/Dhii/Container/Util/StringTranslatingTrait.php b/lib/packages/Dhii/Container/Util/StringTranslatingTrait.php new file mode 100644 index 000000000..206d7e282 --- /dev/null +++ b/lib/packages/Dhii/Container/Util/StringTranslatingTrait.php @@ -0,0 +1,52 @@ + $args Placeholder values to replace in the string. + * @param mixed $context The context for translation. + * + * @return string The translated string. + */ + protected function __(string $string, array $args = array(), $context = null): string + { + $string = $this->_translate($string, $context); + array_unshift($args, $string); + return call_user_func_array('sprintf', $args); + } + + /** + * Translates a string. + * + * A no-op implementation. + * + * @since [*next-version*] + * + * @param string $string The string to translate. + * @param string $context The context to translate the string in. + * + * @return string The translated string. + * phpcs:disable PSR2.Methods.MethodDeclaration.Underscore + */ + protected function _translate(string $string, string $context = null): string + { + return $string; + } +} diff --git a/lib/packages/Dhii/Modular/Module/Exception/ModuleExceptionInterface.php b/lib/packages/Dhii/Modular/Module/Exception/ModuleExceptionInterface.php new file mode 100644 index 000000000..0a3e9a493 --- /dev/null +++ b/lib/packages/Dhii/Modular/Module/Exception/ModuleExceptionInterface.php @@ -0,0 +1,19 @@ + array( diff --git a/modules/ppcp-order-tracking/module.php b/modules/ppcp-order-tracking/module.php index eaf817338..a82bbb033 100644 --- a/modules/ppcp-order-tracking/module.php +++ b/modules/ppcp-order-tracking/module.php @@ -9,7 +9,7 @@ namespace WooCommerce\PayPalCommerce\OrderTracking; -use Dhii\Modular\Module\ModuleInterface; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface; return static function (): ModuleInterface { return new OrderTrackingModule(); diff --git a/modules/ppcp-order-tracking/services.php b/modules/ppcp-order-tracking/services.php index 49a7a995f..0d94999a8 100644 --- a/modules/ppcp-order-tracking/services.php +++ b/modules/ppcp-order-tracking/services.php @@ -9,7 +9,7 @@ namespace WooCommerce\PayPalCommerce\OrderTracking; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use WooCommerce\PayPalCommerce\OrderTracking\Assets\OrderEditPageAssets; use WooCommerce\PayPalCommerce\OrderTracking\Endpoint\OrderTrackingEndpoint; use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway; diff --git a/modules/ppcp-order-tracking/src/OrderTrackingModule.php b/modules/ppcp-order-tracking/src/OrderTrackingModule.php index 5eb06cd19..fb12985f7 100644 --- a/modules/ppcp-order-tracking/src/OrderTrackingModule.php +++ b/modules/ppcp-order-tracking/src/OrderTrackingModule.php @@ -9,11 +9,11 @@ namespace WooCommerce\PayPalCommerce\OrderTracking; -use Dhii\Container\ServiceProvider; -use Dhii\Modular\Module\ModuleInterface; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface; use Exception; -use Interop\Container\ServiceProviderInterface; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; use WC_Order; use WooCommerce\PayPalCommerce\OrderTracking\Assets\OrderEditPageAssets; diff --git a/modules/ppcp-session/module.php b/modules/ppcp-session/module.php index 007f9861f..80392d729 100644 --- a/modules/ppcp-session/module.php +++ b/modules/ppcp-session/module.php @@ -9,7 +9,7 @@ namespace WooCommerce\PayPalCommerce\Session; -use Dhii\Modular\Module\ModuleInterface; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface; return function (): ModuleInterface { return new SessionModule(); diff --git a/modules/ppcp-session/services.php b/modules/ppcp-session/services.php index b5d76e82b..0b36eb95b 100644 --- a/modules/ppcp-session/services.php +++ b/modules/ppcp-session/services.php @@ -9,7 +9,7 @@ namespace WooCommerce\PayPalCommerce\Session; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use WooCommerce\PayPalCommerce\Session\Cancellation\CancelController; use WooCommerce\PayPalCommerce\Session\Cancellation\CancelView; diff --git a/modules/ppcp-session/src/Cancellation/CancelView.php b/modules/ppcp-session/src/Cancellation/CancelView.php index 4727e6b0e..cdaf9b41e 100644 --- a/modules/ppcp-session/src/Cancellation/CancelView.php +++ b/modules/ppcp-session/src/Cancellation/CancelView.php @@ -9,7 +9,7 @@ namespace WooCommerce\PayPalCommerce\Session\Cancellation; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use WooCommerce\PayPalCommerce\WcGateway\FundingSource\FundingSourceRenderer; /** diff --git a/modules/ppcp-session/src/SessionModule.php b/modules/ppcp-session/src/SessionModule.php index 854c93bfb..a27effb47 100644 --- a/modules/ppcp-session/src/SessionModule.php +++ b/modules/ppcp-session/src/SessionModule.php @@ -9,11 +9,11 @@ namespace WooCommerce\PayPalCommerce\Session; -use Dhii\Container\ServiceProvider; -use Dhii\Modular\Module\ModuleInterface; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface; use WooCommerce\PayPalCommerce\Session\Cancellation\CancelController; -use Interop\Container\ServiceProviderInterface; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; /** * Class SessionModule diff --git a/modules/ppcp-status-report/module.php b/modules/ppcp-status-report/module.php index e11470240..35edc894c 100644 --- a/modules/ppcp-status-report/module.php +++ b/modules/ppcp-status-report/module.php @@ -9,7 +9,7 @@ namespace WooCommerce\PayPalCommerce\StatusReport; -use Dhii\Modular\Module\ModuleInterface; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface; return static function (): ModuleInterface { return new StatusReportModule(); diff --git a/modules/ppcp-status-report/src/StatusReportModule.php b/modules/ppcp-status-report/src/StatusReportModule.php index 459d24e60..3e380b069 100644 --- a/modules/ppcp-status-report/src/StatusReportModule.php +++ b/modules/ppcp-status-report/src/StatusReportModule.php @@ -9,10 +9,10 @@ namespace WooCommerce\PayPalCommerce\StatusReport; -use Dhii\Container\ServiceProvider; -use Dhii\Modular\Module\ModuleInterface; -use Interop\Container\ServiceProviderInterface; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface; +use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use WooCommerce\PayPalCommerce\ApiClient\Authentication\Bearer; use WooCommerce\PayPalCommerce\ApiClient\Endpoint\BillingAgreementsEndpoint; use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException; diff --git a/modules/ppcp-subscription/module.php b/modules/ppcp-subscription/module.php index e55512025..1db299a49 100644 --- a/modules/ppcp-subscription/module.php +++ b/modules/ppcp-subscription/module.php @@ -9,7 +9,7 @@ namespace WooCommerce\PayPalCommerce\Subscription; -use Dhii\Modular\Module\ModuleInterface; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface; return static function (): ModuleInterface { return new SubscriptionModule(); diff --git a/modules/ppcp-subscription/services.php b/modules/ppcp-subscription/services.php index bf112050c..a24002869 100644 --- a/modules/ppcp-subscription/services.php +++ b/modules/ppcp-subscription/services.php @@ -10,7 +10,7 @@ namespace WooCommerce\PayPalCommerce\Subscription; use WooCommerce\PayPalCommerce\Subscription\Helper\SubscriptionHelper; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use WooCommerce\PayPalCommerce\Vaulting\PaymentTokenRepository; return array( diff --git a/modules/ppcp-subscription/src/SubscriptionModule.php b/modules/ppcp-subscription/src/SubscriptionModule.php index 3ca2cdfa1..ae21ad42a 100644 --- a/modules/ppcp-subscription/src/SubscriptionModule.php +++ b/modules/ppcp-subscription/src/SubscriptionModule.php @@ -9,8 +9,8 @@ namespace WooCommerce\PayPalCommerce\Subscription; -use Dhii\Container\ServiceProvider; -use Dhii\Modular\Module\ModuleInterface; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface; use Psr\Log\LoggerInterface; use WC_Order; use WC_Subscription; @@ -19,8 +19,8 @@ use WooCommerce\PayPalCommerce\Vaulting\PaymentTokenRepository; use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway; use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway; -use Interop\Container\ServiceProviderInterface; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings; use WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException; diff --git a/modules/ppcp-vaulting/module.php b/modules/ppcp-vaulting/module.php index d9a036a51..fb42c4f9c 100644 --- a/modules/ppcp-vaulting/module.php +++ b/modules/ppcp-vaulting/module.php @@ -9,7 +9,7 @@ namespace WooCommerce\PayPalCommerce\Vaulting; -use Dhii\Modular\Module\ModuleInterface; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface; return static function (): ModuleInterface { return new VaultingModule(); diff --git a/modules/ppcp-vaulting/services.php b/modules/ppcp-vaulting/services.php index 041260fd0..dc03437ff 100644 --- a/modules/ppcp-vaulting/services.php +++ b/modules/ppcp-vaulting/services.php @@ -9,7 +9,7 @@ namespace WooCommerce\PayPalCommerce\Vaulting; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use WooCommerce\PayPalCommerce\Vaulting\Assets\MyAccountPaymentsAssets; use WooCommerce\PayPalCommerce\Vaulting\Endpoint\DeletePaymentTokenEndpoint; diff --git a/modules/ppcp-vaulting/src/VaultedCreditCardHandler.php b/modules/ppcp-vaulting/src/VaultedCreditCardHandler.php index dc95dce35..04b1c8d5d 100644 --- a/modules/ppcp-vaulting/src/VaultedCreditCardHandler.php +++ b/modules/ppcp-vaulting/src/VaultedCreditCardHandler.php @@ -9,7 +9,7 @@ namespace WooCommerce\PayPalCommerce\Vaulting; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use WC_Customer; use WC_Order; use WooCommerce\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint; diff --git a/modules/ppcp-vaulting/src/VaultingModule.php b/modules/ppcp-vaulting/src/VaultingModule.php index 39ee50362..544ce4ef3 100644 --- a/modules/ppcp-vaulting/src/VaultingModule.php +++ b/modules/ppcp-vaulting/src/VaultingModule.php @@ -9,10 +9,10 @@ namespace WooCommerce\PayPalCommerce\Vaulting; -use Dhii\Container\ServiceProvider; -use Dhii\Modular\Module\ModuleInterface; -use Interop\Container\ServiceProviderInterface; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface; +use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; use WC_Order; use WooCommerce\PayPalCommerce\Subscription\Helper\SubscriptionHelper; diff --git a/modules/ppcp-wc-gateway/connection-tab-settings.php b/modules/ppcp-wc-gateway/connection-tab-settings.php index 8ec28d23e..edc38d8ec 100644 --- a/modules/ppcp-wc-gateway/connection-tab-settings.php +++ b/modules/ppcp-wc-gateway/connection-tab-settings.php @@ -11,7 +11,7 @@ namespace WooCommerce\PayPalCommerce\WcGateway; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use WooCommerce\PayPalCommerce\ApiClient\Helper\DccApplies; use WooCommerce\PayPalCommerce\Onboarding\Environment; use WooCommerce\PayPalCommerce\Onboarding\Render\OnboardingOptionsRenderer; diff --git a/modules/ppcp-wc-gateway/extensions.php b/modules/ppcp-wc-gateway/extensions.php index 1cb43d5ba..59b1b34f3 100644 --- a/modules/ppcp-wc-gateway/extensions.php +++ b/modules/ppcp-wc-gateway/extensions.php @@ -15,7 +15,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings; use WooCommerce\WooCommerce\Logging\Logger\NullLogger; use WooCommerce\WooCommerce\Logging\Logger\WooCommerceLogger; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; return array( diff --git a/modules/ppcp-wc-gateway/module.php b/modules/ppcp-wc-gateway/module.php index 881c93daa..64b4601d8 100644 --- a/modules/ppcp-wc-gateway/module.php +++ b/modules/ppcp-wc-gateway/module.php @@ -9,7 +9,7 @@ namespace WooCommerce\PayPalCommerce\WcGateway; -use Dhii\Modular\Module\ModuleInterface; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface; return static function (): ModuleInterface { return new WCGatewayModule(); diff --git a/modules/ppcp-wc-gateway/services.php b/modules/ppcp-wc-gateway/services.php index 13450b81a..1901a961e 100644 --- a/modules/ppcp-wc-gateway/services.php +++ b/modules/ppcp-wc-gateway/services.php @@ -11,7 +11,7 @@ namespace WooCommerce\PayPalCommerce\WcGateway; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use WooCommerce\PayPalCommerce\ApiClient\Authentication\Bearer; use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PayUponInvoiceOrderEndpoint; use WooCommerce\PayPalCommerce\ApiClient\Entity\ApplicationContext; diff --git a/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php b/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php index ee3492209..5adce70ae 100644 --- a/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php +++ b/modules/ppcp-wc-gateway/src/Checkout/DisableGateways.php @@ -13,7 +13,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Gateway\CardButtonGateway; use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway; use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; /** * Class DisableGateways diff --git a/modules/ppcp-wc-gateway/src/Exception/NotFoundException.php b/modules/ppcp-wc-gateway/src/Exception/NotFoundException.php index 790aa140d..3cfc6aad3 100644 --- a/modules/ppcp-wc-gateway/src/Exception/NotFoundException.php +++ b/modules/ppcp-wc-gateway/src/Exception/NotFoundException.php @@ -10,7 +10,7 @@ namespace WooCommerce\PayPalCommerce\WcGateway\Exception; use Exception; -use Psr\Container\NotFoundExceptionInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\NotFoundExceptionInterface; /** * Class NotFoundException diff --git a/modules/ppcp-wc-gateway/src/FundingSource/FundingSourceRenderer.php b/modules/ppcp-wc-gateway/src/FundingSource/FundingSourceRenderer.php index 3d7ad050f..e91d87574 100644 --- a/modules/ppcp-wc-gateway/src/FundingSource/FundingSourceRenderer.php +++ b/modules/ppcp-wc-gateway/src/FundingSource/FundingSourceRenderer.php @@ -9,7 +9,7 @@ namespace WooCommerce\PayPalCommerce\WcGateway\FundingSource; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; /** * Class FundingSourceRenderer diff --git a/modules/ppcp-wc-gateway/src/Gateway/CardButtonGateway.php b/modules/ppcp-wc-gateway/src/Gateway/CardButtonGateway.php index 09b465f01..c5aceb1f5 100644 --- a/modules/ppcp-wc-gateway/src/Gateway/CardButtonGateway.php +++ b/modules/ppcp-wc-gateway/src/Gateway/CardButtonGateway.php @@ -23,7 +23,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Exception\GatewayGenericException; use WooCommerce\PayPalCommerce\WcGateway\Processor\OrderProcessor; use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use WooCommerce\PayPalCommerce\WcGateway\Settings\SettingsRenderer; /** diff --git a/modules/ppcp-wc-gateway/src/Gateway/CreditCardGateway.php b/modules/ppcp-wc-gateway/src/Gateway/CreditCardGateway.php index 354667aca..5d2cc322f 100644 --- a/modules/ppcp-wc-gateway/src/Gateway/CreditCardGateway.php +++ b/modules/ppcp-wc-gateway/src/Gateway/CreditCardGateway.php @@ -25,7 +25,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Processor\OrderProcessor; use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor; use WooCommerce\PayPalCommerce\WcGateway\Settings\SettingsRenderer; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; /** * Class CreditCardGateway diff --git a/modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php b/modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php index c62e87e24..da3745737 100644 --- a/modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php +++ b/modules/ppcp-wc-gateway/src/Gateway/PayPalGateway.php @@ -28,7 +28,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor; use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings; use WooCommerce\PayPalCommerce\WcGateway\Settings\SettingsRenderer; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; /** * Class PayPalGateway diff --git a/modules/ppcp-wc-gateway/src/Notice/ConnectAdminNotice.php b/modules/ppcp-wc-gateway/src/Notice/ConnectAdminNotice.php index 7bea6d2e2..638758017 100644 --- a/modules/ppcp-wc-gateway/src/Notice/ConnectAdminNotice.php +++ b/modules/ppcp-wc-gateway/src/Notice/ConnectAdminNotice.php @@ -12,7 +12,7 @@ use WooCommerce\PayPalCommerce\AdminNotices\Entity\Message; use WooCommerce\PayPalCommerce\Onboarding\State; use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; /** * Class ConnectAdminNotice diff --git a/modules/ppcp-wc-gateway/src/Notice/GatewayWithoutPayPalAdminNotice.php b/modules/ppcp-wc-gateway/src/Notice/GatewayWithoutPayPalAdminNotice.php index 171f50280..08a20651b 100644 --- a/modules/ppcp-wc-gateway/src/Notice/GatewayWithoutPayPalAdminNotice.php +++ b/modules/ppcp-wc-gateway/src/Notice/GatewayWithoutPayPalAdminNotice.php @@ -12,7 +12,7 @@ use WC_Payment_Gateway; use WooCommerce\PayPalCommerce\AdminNotices\Entity\Message; use WooCommerce\PayPalCommerce\Onboarding\State; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; /** * Creates the admin message about the gateway being enabled without the PayPal gateway. diff --git a/modules/ppcp-wc-gateway/src/Processor/AuthorizedPaymentsProcessor.php b/modules/ppcp-wc-gateway/src/Processor/AuthorizedPaymentsProcessor.php index d87c18bfb..db86034d6 100644 --- a/modules/ppcp-wc-gateway/src/Processor/AuthorizedPaymentsProcessor.php +++ b/modules/ppcp-wc-gateway/src/Processor/AuthorizedPaymentsProcessor.php @@ -10,7 +10,7 @@ namespace WooCommerce\PayPalCommerce\WcGateway\Processor; use Exception; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; use WC_Order; use WooCommerce\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint; diff --git a/modules/ppcp-wc-gateway/src/Settings/Settings.php b/modules/ppcp-wc-gateway/src/Settings/Settings.php index 42fd12c48..9a00d421e 100644 --- a/modules/ppcp-wc-gateway/src/Settings/Settings.php +++ b/modules/ppcp-wc-gateway/src/Settings/Settings.php @@ -10,7 +10,7 @@ namespace WooCommerce\PayPalCommerce\WcGateway\Settings; use WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; /** * Class Settings diff --git a/modules/ppcp-wc-gateway/src/Settings/SettingsRenderer.php b/modules/ppcp-wc-gateway/src/Settings/SettingsRenderer.php index fdf4249e8..9c316c631 100644 --- a/modules/ppcp-wc-gateway/src/Settings/SettingsRenderer.php +++ b/modules/ppcp-wc-gateway/src/Settings/SettingsRenderer.php @@ -14,7 +14,7 @@ use WooCommerce\PayPalCommerce\Button\Helper\MessagesApply; use WooCommerce\PayPalCommerce\Onboarding\State; use WooCommerce\PayPalCommerce\WcGateway\Gateway\CreditCardGateway; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use WooCommerce\PayPalCommerce\WcGateway\Helper\DCCProductStatus; use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway; use WooCommerce\PayPalCommerce\WcGateway\Helper\SettingsStatus; diff --git a/modules/ppcp-wc-gateway/src/WCGatewayModule.php b/modules/ppcp-wc-gateway/src/WCGatewayModule.php index 7ad4d64bc..2e4401b09 100644 --- a/modules/ppcp-wc-gateway/src/WCGatewayModule.php +++ b/modules/ppcp-wc-gateway/src/WCGatewayModule.php @@ -9,8 +9,8 @@ namespace WooCommerce\PayPalCommerce\WcGateway; -use Dhii\Container\ServiceProvider; -use Dhii\Modular\Module\ModuleInterface; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface; use WC_Order; use WooCommerce\PayPalCommerce\AdminNotices\Repository\Repository; use WooCommerce\PayPalCommerce\ApiClient\Entity\Capture; @@ -39,8 +39,8 @@ use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings; use WooCommerce\PayPalCommerce\WcGateway\Settings\SettingsListener; use WooCommerce\PayPalCommerce\WcGateway\Settings\SettingsRenderer; -use Interop\Container\ServiceProviderInterface; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; /** * Class WcGatewayModule diff --git a/modules/ppcp-webhooks/module.php b/modules/ppcp-webhooks/module.php index aeb1024c3..7d223a528 100644 --- a/modules/ppcp-webhooks/module.php +++ b/modules/ppcp-webhooks/module.php @@ -9,7 +9,7 @@ namespace WooCommerce\PayPalCommerce\Webhooks; -use Dhii\Modular\Module\ModuleInterface; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface; return static function (): ModuleInterface { return new WebhookModule(); diff --git a/modules/ppcp-webhooks/services.php b/modules/ppcp-webhooks/services.php index ef2b9f3cc..d7ed8013c 100644 --- a/modules/ppcp-webhooks/services.php +++ b/modules/ppcp-webhooks/services.php @@ -25,7 +25,7 @@ use WooCommerce\PayPalCommerce\Webhooks\Handler\PaymentCapturePending; use WooCommerce\PayPalCommerce\Webhooks\Handler\PaymentCaptureRefunded; use WooCommerce\PayPalCommerce\Webhooks\Handler\PaymentCaptureReversed; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use WooCommerce\PayPalCommerce\Webhooks\Handler\VaultCreditCardCreated; use WooCommerce\PayPalCommerce\Webhooks\Handler\VaultPaymentTokenCreated; use WooCommerce\PayPalCommerce\Webhooks\Status\Assets\WebhooksStatusPageAssets; diff --git a/modules/ppcp-webhooks/src/WebhookModule.php b/modules/ppcp-webhooks/src/WebhookModule.php index bcfa321c1..6f8669a8b 100644 --- a/modules/ppcp-webhooks/src/WebhookModule.php +++ b/modules/ppcp-webhooks/src/WebhookModule.php @@ -9,11 +9,11 @@ namespace WooCommerce\PayPalCommerce\Webhooks; -use Dhii\Container\ServiceProvider; -use Dhii\Modular\Module\ModuleInterface; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface; use Exception; -use Interop\Container\ServiceProviderInterface; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings; use WooCommerce\PayPalCommerce\Webhooks\Endpoint\ResubscribeEndpoint; diff --git a/modules/woocommerce-logging/module.php b/modules/woocommerce-logging/module.php index 25d7c70e6..b4ebf4c90 100644 --- a/modules/woocommerce-logging/module.php +++ b/modules/woocommerce-logging/module.php @@ -9,7 +9,7 @@ namespace WooCommerce\WooCommerce\Logging; -use Dhii\Modular\Module\ModuleInterface; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface; return function (): ModuleInterface { return new WooCommerceLoggingModule(); diff --git a/modules/woocommerce-logging/services.php b/modules/woocommerce-logging/services.php index 9c8dfb2de..56bf27f05 100644 --- a/modules/woocommerce-logging/services.php +++ b/modules/woocommerce-logging/services.php @@ -11,7 +11,7 @@ use WooCommerce\WooCommerce\Logging\Logger\NullLogger; use WooCommerce\WooCommerce\Logging\Logger\WooCommerceLogger; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; return array( diff --git a/modules/woocommerce-logging/src/WooCommerceLoggingModule.php b/modules/woocommerce-logging/src/WooCommerceLoggingModule.php index 29cdad07f..b314bc445 100644 --- a/modules/woocommerce-logging/src/WooCommerceLoggingModule.php +++ b/modules/woocommerce-logging/src/WooCommerceLoggingModule.php @@ -9,10 +9,10 @@ namespace WooCommerce\WooCommerce\Logging; -use Dhii\Container\ServiceProvider; -use Dhii\Modular\Module\ModuleInterface; -use Interop\Container\ServiceProviderInterface; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface; +use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; /** * Class WooCommerceLoggingModule diff --git a/src/PluginModule.php b/src/PluginModule.php index 8ed310f4a..5ec283941 100644 --- a/src/PluginModule.php +++ b/src/PluginModule.php @@ -9,10 +9,10 @@ namespace WooCommerce\PayPalCommerce; -use Dhii\Container\ServiceProvider; -use Dhii\Modular\Module\ModuleInterface; -use Interop\Container\ServiceProviderInterface; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Modular\Module\ModuleInterface; +use WooCommerce\PayPalCommerce\Vendor\Interop\Container\ServiceProviderInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; /** * Class PluginModule diff --git a/src/services.php b/src/services.php index e84aee72b..a841c06c0 100644 --- a/src/services.php +++ b/src/services.php @@ -10,7 +10,7 @@ namespace WooCommerce\PayPalCommerce; use Dhii\Versions\StringVersionFactory; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use WpOop\WordPress\Plugin\PluginInterface; return array( diff --git a/tests/PHPUnit/ModularTestCase.php b/tests/PHPUnit/ModularTestCase.php index dc5daa926..8652fecfa 100644 --- a/tests/PHPUnit/ModularTestCase.php +++ b/tests/PHPUnit/ModularTestCase.php @@ -3,11 +3,11 @@ namespace WooCommerce\PayPalCommerce; -use Dhii\Container\CompositeCachingServiceProvider; -use Dhii\Container\DelegatingContainer; -use Dhii\Container\ServiceProvider; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\CompositeCachingServiceProvider; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\DelegatingContainer; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\ServiceProvider; use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use function Brain\Monkey\Functions\when; class ModularTestCase extends TestCase diff --git a/tests/PHPUnit/Subscription/RenewalHandlerTest.php b/tests/PHPUnit/Subscription/RenewalHandlerTest.php index 86b725f49..d079012c3 100644 --- a/tests/PHPUnit/Subscription/RenewalHandlerTest.php +++ b/tests/PHPUnit/Subscription/RenewalHandlerTest.php @@ -3,7 +3,7 @@ namespace WooCommerce\PayPalCommerce\Subscription; -use Dhii\Container\Dictionary; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\Dictionary; use Exception; use Psr\Log\LoggerInterface; use WooCommerce\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint; diff --git a/tests/PHPUnit/Vaulting/VaultedCreditCardHandlerTest.php b/tests/PHPUnit/Vaulting/VaultedCreditCardHandlerTest.php index 5b21b68e3..8a7f9de51 100644 --- a/tests/PHPUnit/Vaulting/VaultedCreditCardHandlerTest.php +++ b/tests/PHPUnit/Vaulting/VaultedCreditCardHandlerTest.php @@ -3,7 +3,7 @@ namespace PHPUnit\Vaulting; use Mockery; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use WC_Customer; use WooCommerce\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint; use WooCommerce\PayPalCommerce\ApiClient\Entity\Capture; diff --git a/tests/PHPUnit/WcGateway/Gateway/CreditCardGatewayTest.php b/tests/PHPUnit/WcGateway/Gateway/CreditCardGatewayTest.php index 0dc0b5e4d..693658756 100644 --- a/tests/PHPUnit/WcGateway/Gateway/CreditCardGatewayTest.php +++ b/tests/PHPUnit/WcGateway/Gateway/CreditCardGatewayTest.php @@ -4,7 +4,7 @@ namespace WooCommerce\PayPalCommerce\WcGateway\Gateway; use Mockery; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; use WC_Order; use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PaymentsEndpoint; diff --git a/tests/PHPUnit/WcGateway/Processor/AuthorizedPaymentsProcessorTest.php b/tests/PHPUnit/WcGateway/Processor/AuthorizedPaymentsProcessorTest.php index 8ebd63794..0d5fd386a 100644 --- a/tests/PHPUnit/WcGateway/Processor/AuthorizedPaymentsProcessorTest.php +++ b/tests/PHPUnit/WcGateway/Processor/AuthorizedPaymentsProcessorTest.php @@ -5,7 +5,7 @@ use Mockery\MockInterface; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use Psr\Log\NullLogger; use WC_Order; use WooCommerce\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint; diff --git a/tests/PHPUnit/WcGateway/Processor/OrderProcessorTest.php b/tests/PHPUnit/WcGateway/Processor/OrderProcessorTest.php index c63a94679..32a2366ca 100644 --- a/tests/PHPUnit/WcGateway/Processor/OrderProcessorTest.php +++ b/tests/PHPUnit/WcGateway/Processor/OrderProcessorTest.php @@ -4,7 +4,7 @@ namespace WooCommerce\PayPalCommerce\WcGateway\Processor; -use Dhii\Container\Dictionary; +use WooCommerce\PayPalCommerce\Vendor\Dhii\Container\Dictionary; use Psr\Log\LoggerInterface; use WooCommerce\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint; use WooCommerce\PayPalCommerce\ApiClient\Entity\Authorization; diff --git a/tests/PHPUnit/WcGateway/Repository/ApplicationContextRepositoryTest.php b/tests/PHPUnit/WcGateway/Repository/ApplicationContextRepositoryTest.php index a7bc0dd87..7d3bf003a 100644 --- a/tests/PHPUnit/WcGateway/Repository/ApplicationContextRepositoryTest.php +++ b/tests/PHPUnit/WcGateway/Repository/ApplicationContextRepositoryTest.php @@ -9,7 +9,7 @@ use WooCommerce\PayPalCommerce\ApiClient\Repository\ApplicationContextRepository; use WooCommerce\PayPalCommerce\TestCase; use Mockery\MockInterface; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use function Brain\Monkey\Functions\expect; class ApplicationContextRepositoryTest extends TestCase diff --git a/tests/e2e/PHPUnit/TestCase.php b/tests/e2e/PHPUnit/TestCase.php index e2f64a9b6..51f770cf9 100644 --- a/tests/e2e/PHPUnit/TestCase.php +++ b/tests/e2e/PHPUnit/TestCase.php @@ -4,7 +4,7 @@ namespace WooCommerce\PayPalCommerce\Tests\E2e; use PPCP_E2E; -use Psr\Container\ContainerInterface; +use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; use WC_Cart; use WC_Customer; use WC_Session; From 956a581acbcabc6a639765e9570eafe62b0025c0 Mon Sep 17 00:00:00 2001 From: Alex P Date: Wed, 9 Nov 2022 10:12:34 +0200 Subject: [PATCH 2/4] Fix new psalm errors --- modules/ppcp-api-client/src/Entity/Capture.php | 4 ++-- modules/ppcp-api-client/src/Entity/Token.php | 10 +++++----- modules/ppcp-api-client/src/Entity/Webhook.php | 12 +++++------- modules/ppcp-api-client/src/Entity/WebhookEvent.php | 11 +++++------ .../src/Factory/PaymentTokenFactory.php | 5 ++--- .../src/Factory/WebhookEventFactory.php | 4 ++-- .../ppcp-api-client/src/Factory/WebhookFactory.php | 7 +++---- psalm.xml.dist | 1 + 8 files changed, 25 insertions(+), 29 deletions(-) diff --git a/modules/ppcp-api-client/src/Entity/Capture.php b/modules/ppcp-api-client/src/Entity/Capture.php index a462f6998..98543437b 100644 --- a/modules/ppcp-api-client/src/Entity/Capture.php +++ b/modules/ppcp-api-client/src/Entity/Capture.php @@ -154,9 +154,9 @@ public function final_capture() : bool { /** * Returns the seller protection object. * - * @return \stdClass + * @return object */ - public function seller_protection() : \stdClass { + public function seller_protection() { return (object) array( 'status' => $this->seller_protection ); } diff --git a/modules/ppcp-api-client/src/Entity/Token.php b/modules/ppcp-api-client/src/Entity/Token.php index 8f41b8479..48a2530ff 100644 --- a/modules/ppcp-api-client/src/Entity/Token.php +++ b/modules/ppcp-api-client/src/Entity/Token.php @@ -19,7 +19,7 @@ class Token { /** * The Token data. * - * @var \stdClass + * @var object */ private $json; @@ -33,10 +33,10 @@ class Token { /** * Token constructor. * - * @param \stdClass $json The JSON object. + * @param object $json The JSON object. * @throws RuntimeException When The JSON object is not valid. */ - public function __construct( \stdClass $json ) { + public function __construct( $json ) { if ( ! isset( $json->created ) ) { $json->created = time(); } @@ -122,11 +122,11 @@ public function vaulting_available(): bool { /** * Validates whether a JSON object can be transformed to a Token object. * - * @param \stdClass $json The JSON object. + * @param object $json The JSON object. * * @return bool */ - private function validate( \stdClass $json ): bool { + private function validate( $json ): bool { $property_map = array( 'created' => 'is_int', 'expires_in' => 'is_int', diff --git a/modules/ppcp-api-client/src/Entity/Webhook.php b/modules/ppcp-api-client/src/Entity/Webhook.php index 8cd6bc120..c4267642c 100644 --- a/modules/ppcp-api-client/src/Entity/Webhook.php +++ b/modules/ppcp-api-client/src/Entity/Webhook.php @@ -9,8 +9,6 @@ namespace WooCommerce\PayPalCommerce\ApiClient\Entity; -use stdClass; - /** * Class Webhook */ @@ -33,16 +31,16 @@ class Webhook { /** * The event types. * - * @var string[] + * @var object[] */ private $event_types; /** * Webhook constructor. * - * @param string $url The URL of the webhook. - * @param stdClass[] $event_types The associated event types. - * @param string $id The id of the webhook. + * @param string $url The URL of the webhook. + * @param object[] $event_types The associated event types. + * @param string $id The id of the webhook. */ public function __construct( string $url, array $event_types, string $id = '' ) { $this->url = $url; @@ -73,7 +71,7 @@ public function url(): string { /** * Returns the event types. * - * @return stdClass[] + * @return object[] */ public function event_types(): array { diff --git a/modules/ppcp-api-client/src/Entity/WebhookEvent.php b/modules/ppcp-api-client/src/Entity/WebhookEvent.php index 8c2da92f6..e3398f83d 100644 --- a/modules/ppcp-api-client/src/Entity/WebhookEvent.php +++ b/modules/ppcp-api-client/src/Entity/WebhookEvent.php @@ -10,7 +10,6 @@ namespace WooCommerce\PayPalCommerce\ApiClient\Entity; use DateTime; -use stdClass; /** * Class WebhookEvent @@ -69,7 +68,7 @@ class WebhookEvent { /** * The resource that triggered the webhook event notification. * - * @var stdClass + * @var object */ private $resource; @@ -83,9 +82,9 @@ class WebhookEvent { * @param string $event_type The event that triggered the webhook event notification, such as 'CHECKOUT.ORDER.APPROVED'. * @param string $summary A summary description for the event notification. * @param string $resource_version The resource version in the webhook notification, such as '1.0'. - * @param stdClass $resource The resource that triggered the webhook event notification. + * @param object $resource The resource that triggered the webhook event notification. */ - public function __construct( string $id, ?DateTime $create_time, string $resource_type, string $event_version, string $event_type, string $summary, string $resource_version, stdClass $resource ) { + public function __construct( string $id, ?DateTime $create_time, string $resource_type, string $event_version, string $event_type, string $summary, string $resource_version, $resource ) { $this->id = $id; $this->create_time = $create_time; $this->resource_type = $resource_type; @@ -162,9 +161,9 @@ public function resource_version(): string { /** * The resource that triggered the webhook event notification. * - * @return stdClass + * @return object */ - public function resource(): stdClass { + public function resource() { return $this->resource; } } diff --git a/modules/ppcp-api-client/src/Factory/PaymentTokenFactory.php b/modules/ppcp-api-client/src/Factory/PaymentTokenFactory.php index 50b21a78f..e1bbbc7ed 100644 --- a/modules/ppcp-api-client/src/Factory/PaymentTokenFactory.php +++ b/modules/ppcp-api-client/src/Factory/PaymentTokenFactory.php @@ -9,7 +9,6 @@ namespace WooCommerce\PayPalCommerce\ApiClient\Factory; -use stdClass; use WooCommerce\PayPalCommerce\ApiClient\Entity\PaymentToken; use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException; @@ -21,12 +20,12 @@ class PaymentTokenFactory { /** * Returns a PaymentToken based off a PayPal Response object. * - * @param \stdClass $data The JSON object. + * @param object $data The JSON object. * * @return PaymentToken * @throws RuntimeException When JSON object is malformed. */ - public function from_paypal_response( stdClass $data ): PaymentToken { + public function from_paypal_response( $data ): PaymentToken { if ( ! isset( $data->id ) ) { throw new RuntimeException( __( 'No id for payment token given', 'woocommerce-paypal-payments' ) diff --git a/modules/ppcp-api-client/src/Factory/WebhookEventFactory.php b/modules/ppcp-api-client/src/Factory/WebhookEventFactory.php index 989ebf18d..30db85516 100644 --- a/modules/ppcp-api-client/src/Factory/WebhookEventFactory.php +++ b/modules/ppcp-api-client/src/Factory/WebhookEventFactory.php @@ -33,12 +33,12 @@ public function from_array( array $data ): WebhookEvent { /** * Returns a Webhook based of a PayPal JSON response. * - * @param stdClass $data The JSON object. + * @param object $data The JSON object. * * @return WebhookEvent * @throws RuntimeException When JSON object is malformed. */ - public function from_paypal_response( stdClass $data ): WebhookEvent { + public function from_paypal_response( $data ): WebhookEvent { if ( ! isset( $data->id ) ) { throw new RuntimeException( __( 'ID for webhook event not found.', 'woocommerce-paypal-payments' ) diff --git a/modules/ppcp-api-client/src/Factory/WebhookFactory.php b/modules/ppcp-api-client/src/Factory/WebhookFactory.php index 413dbd66a..372817458 100644 --- a/modules/ppcp-api-client/src/Factory/WebhookFactory.php +++ b/modules/ppcp-api-client/src/Factory/WebhookFactory.php @@ -9,7 +9,6 @@ namespace WooCommerce\PayPalCommerce\ApiClient\Factory; -use stdClass; use WooCommerce\PayPalCommerce\ApiClient\Entity\Webhook; use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException; @@ -28,7 +27,7 @@ class WebhookFactory { */ public function for_url_and_events( string $url, array $event_types ): Webhook { $event_types = array_map( - static function ( string $type ): stdClass { + static function ( string $type ) { return (object) array( 'name' => $type ); }, $event_types @@ -53,12 +52,12 @@ public function from_array( array $data ): Webhook { /** * Returns a Webhook based of a PayPal JSON response. * - * @param stdClass $data The JSON object. + * @param object $data The JSON object. * * @return Webhook * @throws RuntimeException When JSON object is malformed. */ - public function from_paypal_response( stdClass $data ): Webhook { + public function from_paypal_response( $data ): Webhook { if ( ! isset( $data->id ) ) { throw new RuntimeException( __( 'No id for webhook given.', 'woocommerce-paypal-payments' ) diff --git a/psalm.xml.dist b/psalm.xml.dist index 2c85e71b4..fffe2fa98 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -152,6 +152,7 @@ + From 52a560672eeaf4383570bc337b92953401f5b14f Mon Sep 17 00:00:00 2001 From: Alex P Date: Wed, 9 Nov 2022 10:19:34 +0200 Subject: [PATCH 3/4] Fix isolated deps (php 7.1) --- composer.lock | 8 ++++---- .../Psr/Container/ContainerExceptionInterface.php | 7 ++++--- lib/packages/Psr/Container/ContainerInterface.php | 9 +++++---- .../Psr/Container/NotFoundExceptionInterface.php | 3 +++ 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/composer.lock b/composer.lock index 50d402a39..060859f62 100644 --- a/composer.lock +++ b/composer.lock @@ -809,12 +809,12 @@ } }, "autoload": { - "psr-4": { - "Amp\\ByteStream\\": "lib" - }, "files": [ "lib/functions.php" - ] + ], + "psr-4": { + "Amp\\ByteStream\\": "lib" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ diff --git a/lib/packages/Psr/Container/ContainerExceptionInterface.php b/lib/packages/Psr/Container/ContainerExceptionInterface.php index 1215883b7..e36fa7885 100644 --- a/lib/packages/Psr/Container/ContainerExceptionInterface.php +++ b/lib/packages/Psr/Container/ContainerExceptionInterface.php @@ -1,12 +1,13 @@ Date: Wed, 9 Nov 2022 11:20:35 +0200 Subject: [PATCH 4/4] Move isolated deps to require-dev --- composer.json | 6 +- composer.lock | 216 +++++++++++++++++++++++++------------------------- 2 files changed, 111 insertions(+), 111 deletions(-) diff --git a/composer.json b/composer.json index 0a2509eb2..04df062fb 100644 --- a/composer.json +++ b/composer.json @@ -6,9 +6,6 @@ "require": { "php": "^7.1 | ^8.0", "ext-json": "*", - "dhii/module-interface": "^0.2 || ^0.3", - "container-interop/service-provider": "^0.4.0", - "dhii/containers": "^0.1.0-alpha1", "psr/log": "^1.1", "ralouphie/getallheaders": "^3.0", "wikimedia/composer-merge-plugin": "^1.4", @@ -18,6 +15,9 @@ }, "require-dev": { "psr/container": "^1.0", + "dhii/module-interface": "^0.2 || ^0.3", + "container-interop/service-provider": "^0.4.0", + "dhii/containers": "^0.1.0-alpha1", "woocommerce/woocommerce-sniffs": "^0.1.0", "phpunit/phpunit": "^7.0 | ^8.0 | ^9.0", "brain/monkey": "^2.4", diff --git a/composer.lock b/composer.lock index 060859f62..226706d4e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2b16b39502bcfa86aaf9a9a53d78b187", + "content-hash": "7cab7228653731c826171dbf4956da77", "packages": [ { "name": "container-interop/service-provider", @@ -37,113 +37,6 @@ "homepage": "https://github.com/container-interop/service-provider", "time": "2017-09-20T14:13:36+00:00" }, - { - "name": "dhii/collections-interface", - "version": "v0.3.0", - "source": { - "type": "git", - "url": "https://github.com/Dhii/collections-interface.git", - "reference": "74464a969b340d16889eacd9eadc9817f7e7f47a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Dhii/collections-interface/zipball/74464a969b340d16889eacd9eadc9817f7e7f47a", - "reference": "74464a969b340d16889eacd9eadc9817f7e7f47a", - "shasum": "" - }, - "require": { - "php": "^7.1 | ^8.0", - "psr/container": "^1.0" - }, - "require-dev": { - "phpunit/phpunit": "^7.0 | ^8.0 | ^9.0", - "slevomat/coding-standard": "^6.0", - "vimeo/psalm": "^4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-develop": "0.3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Dhii\\Collection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dhii Team", - "email": "development@dhii.co" - }, - { - "name": "Anton Ukhanev", - "email": "xedin.unknown@gmail.com" - } - ], - "description": "A highly ISP-compliant collection of interfaces that represent maps and lists.", - "time": "2021-10-06T10:56:09+00:00" - }, - { - "name": "dhii/containers", - "version": "v0.1.4", - "source": { - "type": "git", - "url": "https://github.com/Dhii/containers.git", - "reference": "42ab24683183fa0dc155f26c6a470ef697bbdc9a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Dhii/containers/zipball/42ab24683183fa0dc155f26c6a470ef697bbdc9a", - "reference": "42ab24683183fa0dc155f26c6a470ef697bbdc9a", - "shasum": "" - }, - "require": { - "container-interop/service-provider": "^0.4", - "dhii/collections-interface": "^0.3.0-alpha4", - "php": "^7.1 | ^8.0" - }, - "require-dev": { - "gmazzap/andrew": "^1.1", - "phpunit/phpunit": "^7.0 | ^8.0 | ^9.0", - "psr/container": "^1.0", - "psr/simple-cache": "^1.0", - "slevomat/coding-standard": "^6.0", - "vimeo/psalm": "^4.0", - "wildwolf/psr-memory-cache": "^1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-develop": "0.1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Dhii\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dhii Team", - "email": "development@dhii.co" - } - ], - "description": "A selection of PSR-11 containers for utility, simplicity, and ease.", - "keywords": [ - "PSR-11", - "container" - ], - "time": "2021-10-06T11:13:51+00:00" - }, { "name": "dhii/human-readable-interface", "version": "v0.2.0-alpha1", @@ -1302,6 +1195,113 @@ ], "time": "2022-02-04T12:51:07+00:00" }, + { + "name": "dhii/collections-interface", + "version": "v0.3.0", + "source": { + "type": "git", + "url": "https://github.com/Dhii/collections-interface.git", + "reference": "74464a969b340d16889eacd9eadc9817f7e7f47a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dhii/collections-interface/zipball/74464a969b340d16889eacd9eadc9817f7e7f47a", + "reference": "74464a969b340d16889eacd9eadc9817f7e7f47a", + "shasum": "" + }, + "require": { + "php": "^7.1 | ^8.0", + "psr/container": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^7.0 | ^8.0 | ^9.0", + "slevomat/coding-standard": "^6.0", + "vimeo/psalm": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Dhii\\Collection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dhii Team", + "email": "development@dhii.co" + }, + { + "name": "Anton Ukhanev", + "email": "xedin.unknown@gmail.com" + } + ], + "description": "A highly ISP-compliant collection of interfaces that represent maps and lists.", + "time": "2021-10-06T10:56:09+00:00" + }, + { + "name": "dhii/containers", + "version": "v0.1.4", + "source": { + "type": "git", + "url": "https://github.com/Dhii/containers.git", + "reference": "42ab24683183fa0dc155f26c6a470ef697bbdc9a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dhii/containers/zipball/42ab24683183fa0dc155f26c6a470ef697bbdc9a", + "reference": "42ab24683183fa0dc155f26c6a470ef697bbdc9a", + "shasum": "" + }, + "require": { + "container-interop/service-provider": "^0.4", + "dhii/collections-interface": "^0.3.0-alpha4", + "php": "^7.1 | ^8.0" + }, + "require-dev": { + "gmazzap/andrew": "^1.1", + "phpunit/phpunit": "^7.0 | ^8.0 | ^9.0", + "psr/container": "^1.0", + "psr/simple-cache": "^1.0", + "slevomat/coding-standard": "^6.0", + "vimeo/psalm": "^4.0", + "wildwolf/psr-memory-cache": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Dhii\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dhii Team", + "email": "development@dhii.co" + } + ], + "description": "A selection of PSR-11 containers for utility, simplicity, and ease.", + "keywords": [ + "PSR-11", + "container" + ], + "time": "2021-10-06T11:13:51+00:00" + }, { "name": "dnoegel/php-xdg-base-dir", "version": "v0.1.1",