diff --git a/composer.json b/composer.json index e413904cf..3fe329cc6 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "container-interop/service-provider": "^0.4.0", "dhii/containers": "^0.1.0-alpha1", "inpsyde/modularity": "^1.7", - "woocommerce/woocommerce-sniffs": "^0.1.0", + "woocommerce/woocommerce-sniffs": "^1.0.0", "phpunit/phpunit": "^7.0 | ^8.0 | ^9.0", "brain/monkey": "^2.4", "php-stubs/wordpress-stubs": "^5.0@stable", diff --git a/composer.lock b/composer.lock index 05ea6e974..5b80e9e7b 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": "6ca9c2c7864d2649617db6d3850382c5", + "content-hash": "fd277e5a82374078694b99b0e6aef07c", "packages": [ { "name": "container-interop/service-provider", @@ -1263,35 +1263,38 @@ }, { "name": "dealerdirect/phpcodesniffer-composer-installer", - "version": "v0.7.2", + "version": "v1.1.2", "source": { "type": "git", - "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", - "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db" + "url": "https://github.com/PHPCSStandards/composer-installer.git", + "reference": "e9cf5e4bbf7eeaf9ef5db34938942602838fc2b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", - "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", + "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/e9cf5e4bbf7eeaf9ef5db34938942602838fc2b1", + "reference": "e9cf5e4bbf7eeaf9ef5db34938942602838fc2b1", "shasum": "" }, "require": { - "composer-plugin-api": "^1.0 || ^2.0", - "php": ">=5.3", + "composer-plugin-api": "^2.2", + "php": ">=5.4", "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" }, "require-dev": { - "composer/composer": "*", - "php-parallel-lint/php-parallel-lint": "^1.3.1", - "phpcompatibility/php-compatibility": "^9.0" + "composer/composer": "^2.2", + "ext-json": "*", + "ext-zip": "*", + "php-parallel-lint/php-parallel-lint": "^1.4.0", + "phpcompatibility/php-compatibility": "^9.0", + "yoast/phpunit-polyfills": "^1.0" }, "type": "composer-plugin", "extra": { - "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + "class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" }, "autoload": { "psr-4": { - "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1301,17 +1304,16 @@ "authors": [ { "name": "Franck Nijhof", - "email": "franck.nijhof@dealerdirect.com", - "homepage": "http://www.frenck.nl", - "role": "Developer / IT Manager" + "email": "opensource@frenck.dev", + "homepage": "https://frenck.dev", + "role": "Open source developer" }, { "name": "Contributors", - "homepage": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer/graphs/contributors" + "homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors" } ], "description": "PHP_CodeSniffer Standards Composer Installer Plugin", - "homepage": "http://www.dealerdirect.com", "keywords": [ "PHPCodeSniffer", "PHP_CodeSniffer", @@ -1331,10 +1333,29 @@ "tests" ], "support": { - "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues", - "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer" + "issues": "https://github.com/PHPCSStandards/composer-installer/issues", + "security": "https://github.com/PHPCSStandards/composer-installer/security/policy", + "source": "https://github.com/PHPCSStandards/composer-installer" }, - "time": "2022-02-04T12:51:07+00:00" + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" + } + ], + "time": "2025-07-17T20:45:56+00:00" }, { "name": "dhii/collections-interface", @@ -2817,6 +2838,181 @@ ], "time": "2025-05-12T16:38:37+00:00" }, + { + "name": "phpcsstandards/phpcsextra", + "version": "1.4.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSExtra.git", + "reference": "fa4b8d051e278072928e32d817456a7fdb57b6ca" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/fa4b8d051e278072928e32d817456a7fdb57b6ca", + "reference": "fa4b8d051e278072928e32d817456a7fdb57b6ca", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "phpcsstandards/phpcsutils": "^1.1.0", + "squizlabs/php_codesniffer": "^3.13.0 || ^4.0" + }, + "require-dev": { + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.4.0", + "phpcsstandards/phpcsdevcs": "^1.1.6", + "phpcsstandards/phpcsdevtools": "^1.2.1", + "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSExtra/graphs/contributors" + } + ], + "description": "A collection of sniffs and standards for use with PHP_CodeSniffer.", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHPCSExtra/issues", + "security": "https://github.com/PHPCSStandards/PHPCSExtra/security/policy", + "source": "https://github.com/PHPCSStandards/PHPCSExtra" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" + } + ], + "time": "2025-06-14T07:40:39+00:00" + }, + { + "name": "phpcsstandards/phpcsutils", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSUtils.git", + "reference": "f7eb16f2fa4237d5db9e8fed8050239bee17a9bd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/f7eb16f2fa4237d5db9e8fed8050239bee17a9bd", + "reference": "f7eb16f2fa4237d5db9e8fed8050239bee17a9bd", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", + "php": ">=5.4", + "squizlabs/php_codesniffer": "^3.13.0 || ^4.0" + }, + "require-dev": { + "ext-filter": "*", + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.4.0", + "phpcsstandards/phpcsdevcs": "^1.1.6", + "yoast/phpunit-polyfills": "^1.1.0 || ^2.0.0 || ^3.0.0" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "autoload": { + "classmap": [ + "PHPCSUtils/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSUtils/graphs/contributors" + } + ], + "description": "A suite of utility functions for use with PHP_CodeSniffer", + "homepage": "https://phpcsutils.com/", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "phpcs3", + "phpcs4", + "standards", + "static analysis", + "tokens", + "utility" + ], + "support": { + "docs": "https://phpcsutils.com/", + "issues": "https://github.com/PHPCSStandards/PHPCSUtils/issues", + "security": "https://github.com/PHPCSStandards/PHPCSUtils/security/policy", + "source": "https://github.com/PHPCSStandards/PHPCSUtils" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" + } + ], + "time": "2025-08-10T01:04:45+00:00" + }, { "name": "phpdocumentor/reflection-common", "version": "2.2.0", @@ -5737,74 +5933,77 @@ }, { "name": "woocommerce/woocommerce-sniffs", - "version": "0.1.3", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/woocommerce/woocommerce-sniffs.git", - "reference": "4576d54595614d689bc4436acff8baaece3c5bb0" + "reference": "3a65b917ff5ab5e65609e5dcb7bc62f9455bbef8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/woocommerce/woocommerce-sniffs/zipball/4576d54595614d689bc4436acff8baaece3c5bb0", - "reference": "4576d54595614d689bc4436acff8baaece3c5bb0", + "url": "https://api.github.com/repos/woocommerce/woocommerce-sniffs/zipball/3a65b917ff5ab5e65609e5dcb7bc62f9455bbef8", + "reference": "3a65b917ff5ab5e65609e5dcb7bc62f9455bbef8", "shasum": "" }, "require": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0.0", "php": ">=7.0", "phpcompatibility/phpcompatibility-wp": "^2.1.0", - "wp-coding-standards/wpcs": "^2.3.0" + "wp-coding-standards/wpcs": "^3.0.0" }, "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "authors": [ - { - "name": "Claudio Sanches", - "email": "claudio@automattic.com" - } - ], "description": "WooCommerce sniffs", "keywords": [ "phpcs", "standards", + "static analysis", "woocommerce", "wordpress" ], "support": { "issues": "https://github.com/woocommerce/woocommerce-sniffs/issues", - "source": "https://github.com/woocommerce/woocommerce-sniffs/tree/0.1.3" + "source": "https://github.com/woocommerce/woocommerce-sniffs/tree/1.0.0" }, - "time": "2022-02-17T15:34:51+00:00" + "time": "2023-09-29T13:52:33+00:00" }, { "name": "wp-coding-standards/wpcs", - "version": "2.3.0", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", - "reference": "7da1894633f168fe244afc6de00d141f27517b62" + "reference": "d2421de7cec3274ae622c22c744de9a62c7925af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/7da1894633f168fe244afc6de00d141f27517b62", - "reference": "7da1894633f168fe244afc6de00d141f27517b62", + "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/d2421de7cec3274ae622c22c744de9a62c7925af", + "reference": "d2421de7cec3274ae622c22c744de9a62c7925af", "shasum": "" }, "require": { + "ext-filter": "*", + "ext-libxml": "*", + "ext-tokenizer": "*", + "ext-xmlreader": "*", "php": ">=5.4", - "squizlabs/php_codesniffer": "^3.3.1" + "phpcsstandards/phpcsextra": "^1.4.0", + "phpcsstandards/phpcsutils": "^1.1.0", + "squizlabs/php_codesniffer": "^3.13.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || ^0.6", + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.4.0", "phpcompatibility/php-compatibility": "^9.0", - "phpcsstandards/phpcsdevtools": "^1.0", - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "phpcsstandards/phpcsdevtools": "^1.2.0", + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.6 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically." + "ext-iconv": "For improved results", + "ext-mbstring": "For improved results" }, "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", @@ -5821,6 +6020,7 @@ "keywords": [ "phpcs", "standards", + "static analysis", "wordpress" ], "support": { @@ -5828,14 +6028,20 @@ "source": "https://github.com/WordPress/WordPress-Coding-Standards", "wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki" }, - "time": "2020-05-13T23:57:56+00:00" + "funding": [ + { + "url": "https://opencollective.com/php_codesniffer", + "type": "custom" + } + ], + "time": "2025-07-24T20:08:31+00:00" } ], "aliases": [], "minimum-stability": "dev", "stability-flags": { - "php-stubs/wordpress-stubs": 0, - "php-stubs/woocommerce-stubs": 0 + "php-stubs/woocommerce-stubs": 0, + "php-stubs/wordpress-stubs": 0 }, "prefer-stable": true, "prefer-lowest": false, @@ -5843,7 +6049,7 @@ "php": "^7.4 | ^8.0", "ext-json": "*" }, - "platform-dev": [], + "platform-dev": {}, "platform-overrides": { "php": "7.4" }, diff --git a/modules/ppcp-admin-notices/src/AdminNotices.php b/modules/ppcp-admin-notices/src/AdminNotices.php index 47067f25e..0eb9d18e5 100644 --- a/modules/ppcp-admin-notices/src/AdminNotices.php +++ b/modules/ppcp-admin-notices/src/AdminNotices.php @@ -49,7 +49,7 @@ class AdminNotices implements ServiceModule, ExtendingModule, ExecutableModule { add_action( 'admin_notices', - function() use ( $renderer ) { + function () use ( $renderer ) { $renderer->render(); } ); @@ -113,11 +113,10 @@ class AdminNotices implements ServiceModule, ExtendingModule, ExecutableModule { add_action( 'woocommerce_init', - function() { + function () { if ( is_admin() && is_callable( array( WC(), 'is_wc_admin_active' ) ) && WC()->is_wc_admin_active() && class_exists( 'Automattic\WooCommerce\Admin\Notes\Notes' ) ) { MexicoInstallmentsNote::init(); } - } ); diff --git a/modules/ppcp-admin-notices/src/Endpoint/MuteMessageEndpoint.php b/modules/ppcp-admin-notices/src/Endpoint/MuteMessageEndpoint.php index 9a67b8511..3ef41b220 100644 --- a/modules/ppcp-admin-notices/src/Endpoint/MuteMessageEndpoint.php +++ b/modules/ppcp-admin-notices/src/Endpoint/MuteMessageEndpoint.php @@ -53,7 +53,7 @@ class MuteMessageEndpoint { * * @return string */ - public static function nonce() : string { + public static function nonce(): string { return self::ENDPOINT; } @@ -62,7 +62,7 @@ class MuteMessageEndpoint { * * @return void */ - public function handle_request() : void { + public function handle_request(): void { try { $data = $this->request_data->read_request( $this->nonce() ); } catch ( RuntimeException $ex ) { diff --git a/modules/ppcp-admin-notices/src/Entity/Message.php b/modules/ppcp-admin-notices/src/Entity/Message.php index c41bc131c..7fa744777 100644 --- a/modules/ppcp-admin-notices/src/Entity/Message.php +++ b/modules/ppcp-admin-notices/src/Entity/Message.php @@ -62,7 +62,7 @@ class Message { * * @return string */ - public function message() : string { + public function message(): string { return $this->message; } @@ -71,7 +71,7 @@ class Message { * * @return string */ - public function type() : string { + public function type(): string { return $this->type; } @@ -80,7 +80,7 @@ class Message { * * @return bool */ - public function is_dismissible() : bool { + public function is_dismissible(): bool { return $this->dismissible; } @@ -89,7 +89,7 @@ class Message { * * @return string */ - public function wrapper() : string { + public function wrapper(): string { return $this->wrapper; } @@ -98,7 +98,7 @@ class Message { * * @return array */ - public function to_array() : array { + public function to_array(): array { return array( 'type' => $this->type, 'message' => $this->message, @@ -114,7 +114,7 @@ class Message { * * @return Message */ - public static function from_array( array $data ) : Message { + public static function from_array( array $data ): Message { return new Message( (string) ( $data['message'] ?? '' ), (string) ( $data['type'] ?? '' ), diff --git a/modules/ppcp-admin-notices/src/Entity/PersistentMessage.php b/modules/ppcp-admin-notices/src/Entity/PersistentMessage.php index 4a173a02d..de232cd52 100644 --- a/modules/ppcp-admin-notices/src/Entity/PersistentMessage.php +++ b/modules/ppcp-admin-notices/src/Entity/PersistentMessage.php @@ -47,7 +47,7 @@ class PersistentMessage extends Message { * * @return string */ - public function id( bool $with_db_prefix = false ) : string { + public function id( bool $with_db_prefix = false ): string { if ( ! $this->message_id ) { return ''; } @@ -58,7 +58,7 @@ class PersistentMessage extends Message { /** * {@inheritDoc} */ - public function to_array() : array { + public function to_array(): array { $data = parent::to_array(); $data['id'] = $this->message_id; @@ -70,7 +70,7 @@ class PersistentMessage extends Message { * * @return PersistentMessage */ - public static function from_array( array $data ) : Message { + public static function from_array( array $data ): Message { return new PersistentMessage( (string) ( $data['id'] ?? '' ), (string) ( $data['message'] ?? '' ), @@ -84,7 +84,7 @@ class PersistentMessage extends Message { * * @return bool */ - public function is_muted() : bool { + public function is_muted(): bool { $user_id = get_current_user_id(); if ( ! $this->message_id || ! $user_id ) { @@ -99,7 +99,7 @@ class PersistentMessage extends Message { * * @return void */ - public function mute() : void { + public function mute(): void { $user_id = get_current_user_id(); if ( $this->message_id && $user_id && ! $this->is_muted() ) { @@ -112,7 +112,7 @@ class PersistentMessage extends Message { * * @return void */ - public static function clear_all() : void { + public static function clear_all(): void { global $wpdb; $wpdb->query( diff --git a/modules/ppcp-admin-notices/src/Renderer/Renderer.php b/modules/ppcp-admin-notices/src/Renderer/Renderer.php index 527d83dd4..bcf220fef 100644 --- a/modules/ppcp-admin-notices/src/Renderer/Renderer.php +++ b/modules/ppcp-admin-notices/src/Renderer/Renderer.php @@ -95,7 +95,7 @@ class Renderer implements RendererInterface { /** * {@inheritDoc} */ - public function enqueue_admin() : void { + public function enqueue_admin(): void { if ( ! $this->can_mute_message ) { return; } @@ -129,7 +129,7 @@ class Renderer implements RendererInterface { * * @return array */ - protected function script_data_for_admin() : array { + protected function script_data_for_admin(): array { $ajax_url = admin_url( 'admin-ajax.php' ); return array( diff --git a/modules/ppcp-admin-notices/src/Renderer/RendererInterface.php b/modules/ppcp-admin-notices/src/Renderer/RendererInterface.php index ad0044341..c4376e8b0 100644 --- a/modules/ppcp-admin-notices/src/Renderer/RendererInterface.php +++ b/modules/ppcp-admin-notices/src/Renderer/RendererInterface.php @@ -26,5 +26,5 @@ interface RendererInterface { * * @return void */ - public function enqueue_admin() : void; + public function enqueue_admin(): void; } diff --git a/modules/ppcp-admin-notices/src/Repository/Repository.php b/modules/ppcp-admin-notices/src/Repository/Repository.php index 72d88c69c..d3fc5e367 100644 --- a/modules/ppcp-admin-notices/src/Repository/Repository.php +++ b/modules/ppcp-admin-notices/src/Repository/Repository.php @@ -25,7 +25,7 @@ class Repository implements RepositoryInterface { * * @return Message[] */ - public function current_message() : array { + public function current_message(): array { return array_filter( /** * Returns the list of admin messages. @@ -34,7 +34,7 @@ class Repository implements RepositoryInterface { self::NOTICES_FILTER, array() ), - function ( $element ) : bool { + function ( $element ): bool { if ( $element instanceof PersistentMessage ) { return ! $element->is_muted(); } @@ -51,7 +51,7 @@ class Repository implements RepositoryInterface { * * @return void */ - public function persist( Message $message ) : void { + public function persist( Message $message ): void { $persisted_notices = get_option( self::PERSISTED_NOTICES_OPTION ) ?: array(); $persisted_notices[] = $message->to_array(); @@ -64,7 +64,7 @@ class Repository implements RepositoryInterface { * * @return array|Message[] */ - public function get_persisted_and_clear() : array { + public function get_persisted_and_clear(): array { $notices = array(); $persisted_data = get_option( self::PERSISTED_NOTICES_OPTION ) ?: array(); diff --git a/modules/ppcp-api-client/services.php b/modules/ppcp-api-client/services.php index 92d5319d8..581839943 100644 --- a/modules/ppcp-api-client/services.php +++ b/modules/ppcp-api-client/services.php @@ -86,7 +86,7 @@ use WooCommerce\PayPalCommerce\WcGateway\Helper\EnvironmentConfig; use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings; return array( - 'api.host' => static function( ContainerInterface $container ) : string { + 'api.host' => static function ( ContainerInterface $container ): string { $environment = $container->get( 'settings.environment' ); assert( $environment instanceof Environment ); @@ -96,25 +96,25 @@ return array( return (string) $container->get( 'api.production-host' ); }, - 'api.paypal-host' => function( ContainerInterface $container ) : string { + 'api.paypal-host' => function ( ContainerInterface $container ): string { return PAYPAL_API_URL; }, // It seems this 'api.paypal-website-url' key is always overridden in ppcp-onboarding/services.php. - 'api.paypal-website-url' => function( ContainerInterface $container ) : string { + 'api.paypal-website-url' => function ( ContainerInterface $container ): string { return PAYPAL_URL; }, - 'api.factory.paypal-checkout-url' => function( ContainerInterface $container ) : callable { + 'api.factory.paypal-checkout-url' => function ( ContainerInterface $container ): callable { return function ( string $id ) use ( $container ): string { return $container->get( 'api.paypal-website-url' ) . '/checkoutnow?token=' . $id; }; }, - 'api.partner_merchant_id' => static function () : string { + 'api.partner_merchant_id' => static function (): string { return ''; }, - 'api.merchant_email' => function () : string { + 'api.merchant_email' => function (): string { return ''; }, - 'api.merchant_id' => function () : string { + 'api.merchant_id' => function (): string { return ''; }, 'api.key' => static function (): string { @@ -142,7 +142,7 @@ return array( $container->get( 'wcgateway.settings' ) ); }, - 'api.endpoint.partners' => static function ( ContainerInterface $container ) : PartnersEndpoint { + 'api.endpoint.partners' => static function ( ContainerInterface $container ): PartnersEndpoint { return new PartnersEndpoint( $container->get( 'api.host' ), $container->get( 'api.bearer' ), @@ -153,10 +153,10 @@ return array( $container->get( 'api.helper.failure-registry' ) ); }, - 'api.factory.sellerstatus' => static function ( ContainerInterface $container ) : SellerStatusFactory { + 'api.factory.sellerstatus' => static function ( ContainerInterface $container ): SellerStatusFactory { return new SellerStatusFactory(); }, - 'api.endpoint.payment-token' => static function ( ContainerInterface $container ) : PaymentTokenEndpoint { + 'api.endpoint.payment-token' => static function ( ContainerInterface $container ): PaymentTokenEndpoint { return new PaymentTokenEndpoint( $container->get( 'api.host' ), $container->get( 'api.bearer' ), @@ -166,14 +166,14 @@ return array( $container->get( 'api.repository.customer' ) ); }, - 'api.endpoint.payment-tokens' => static function( ContainerInterface $container ) : PaymentTokensEndpoint { + 'api.endpoint.payment-tokens' => static function ( ContainerInterface $container ): PaymentTokensEndpoint { return new PaymentTokensEndpoint( $container->get( 'api.host' ), $container->get( 'api.bearer' ), $container->get( 'woocommerce.logger.woocommerce' ) ); }, - 'api.endpoint.webhook' => static function ( ContainerInterface $container ) : WebhookEndpoint { + 'api.endpoint.webhook' => static function ( ContainerInterface $container ): WebhookEndpoint { return new WebhookEndpoint( $container->get( 'api.host' ), @@ -183,7 +183,7 @@ return array( $container->get( 'woocommerce.logger.woocommerce' ) ); }, - 'api.endpoint.partner-referrals' => static function ( ContainerInterface $container ) : PartnerReferrals { + 'api.endpoint.partner-referrals' => static function ( ContainerInterface $container ): PartnerReferrals { return new PartnerReferrals( $container->get( 'api.host' ), @@ -191,7 +191,7 @@ return array( $container->get( 'woocommerce.logger.woocommerce' ) ); }, - 'api.endpoint.partner-referrals-sandbox' => static function ( ContainerInterface $container ) : PartnerReferrals { + 'api.endpoint.partner-referrals-sandbox' => static function ( ContainerInterface $container ): PartnerReferrals { return new PartnerReferrals( CONNECT_WOO_SANDBOX_URL, @@ -199,7 +199,7 @@ return array( $container->get( 'woocommerce.logger.woocommerce' ) ); }, - 'api.endpoint.partner-referrals-production' => static function ( ContainerInterface $container ) : PartnerReferrals { + 'api.endpoint.partner-referrals-production' => static function ( ContainerInterface $container ): PartnerReferrals { return new PartnerReferrals( CONNECT_WOO_URL, @@ -207,7 +207,7 @@ return array( $container->get( 'woocommerce.logger.woocommerce' ) ); }, - 'api.endpoint.identity-token' => static function ( ContainerInterface $container ) : IdentityToken { + 'api.endpoint.identity-token' => static function ( ContainerInterface $container ): IdentityToken { $logger = $container->get( 'woocommerce.logger.woocommerce' ); $settings = $container->get( 'wcgateway.settings' ); $customer_repository = $container->get( 'api.repository.customer' ); @@ -232,7 +232,7 @@ return array( $logger ); }, - 'api.endpoint.login-seller' => static function ( ContainerInterface $container ) : LoginSeller { + 'api.endpoint.login-seller' => static function ( ContainerInterface $container ): LoginSeller { $logger = $container->get( 'woocommerce.logger.woocommerce' ); return new LoginSeller( @@ -287,7 +287,7 @@ return array( $container->get( 'woocommerce.logger.woocommerce' ) ); }, - 'api.endpoint.billing-plans' => static function( ContainerInterface $container ): BillingPlans { + 'api.endpoint.billing-plans' => static function ( ContainerInterface $container ): BillingPlans { return new BillingPlans( $container->get( 'api.host' ), $container->get( 'api.bearer' ), @@ -296,21 +296,21 @@ return array( $container->get( 'woocommerce.logger.woocommerce' ) ); }, - 'api.endpoint.billing-subscriptions' => static function( ContainerInterface $container ): BillingSubscriptions { + 'api.endpoint.billing-subscriptions' => static function ( ContainerInterface $container ): BillingSubscriptions { return new BillingSubscriptions( $container->get( 'api.host' ), $container->get( 'api.bearer' ), $container->get( 'woocommerce.logger.woocommerce' ) ); }, - 'api.endpoint.payment-method-tokens' => static function( ContainerInterface $container ): PaymentMethodTokensEndpoint { + 'api.endpoint.payment-method-tokens' => static function ( ContainerInterface $container ): PaymentMethodTokensEndpoint { return new PaymentMethodTokensEndpoint( $container->get( 'api.host' ), $container->get( 'api.bearer' ), $container->get( 'woocommerce.logger.woocommerce' ) ); }, - 'api.repository.partner-referrals-data' => static function ( ContainerInterface $container ) : PartnerReferralsData { + 'api.repository.partner-referrals-data' => static function ( ContainerInterface $container ): PartnerReferralsData { $dcc_applies = $container->get( 'api.helpers.dccapplies' ); return new PartnerReferralsData( $dcc_applies ); @@ -320,11 +320,11 @@ return array( $merchant_id = $container->get( 'api.merchant_id' ); return new PayeeRepository( $merchant_email, $merchant_id ); }, - 'api.repository.customer' => static function( ContainerInterface $container ): CustomerRepository { + 'api.repository.customer' => static function ( ContainerInterface $container ): CustomerRepository { $prefix = $container->get( 'api.prefix' ); return new CustomerRepository( $prefix ); }, - 'api.repository.order' => static function( ContainerInterface $container ): OrderRepository { + 'api.repository.order' => static function ( ContainerInterface $container ): OrderRepository { return new OrderRepository( $container->get( 'api.endpoint.order' ) ); @@ -345,10 +345,10 @@ return array( $container->get( 'settings.merchant-details' ) ); }, - 'api.factory.payment-token' => static function ( ContainerInterface $container ) : PaymentTokenFactory { + 'api.factory.payment-token' => static function ( ContainerInterface $container ): PaymentTokenFactory { return new PaymentTokenFactory(); }, - 'api.factory.payment-token-action-links' => static function ( ContainerInterface $container ) : PaymentTokenActionLinksFactory { + 'api.factory.payment-token-action-links' => static function ( ContainerInterface $container ): PaymentTokenActionLinksFactory { return new PaymentTokenActionLinksFactory(); }, 'api.factory.webhook' => static function ( ContainerInterface $container ): WebhookFactory { @@ -485,25 +485,25 @@ return array( 'api.factory.fraud-processor-response' => static function ( ContainerInterface $container ): FraudProcessorResponseFactory { return new FraudProcessorResponseFactory(); }, - 'api.factory.product' => static function( ContainerInterface $container ): ProductFactory { + 'api.factory.product' => static function ( ContainerInterface $container ): ProductFactory { return new ProductFactory(); }, - 'api.factory.billing-cycle' => static function( ContainerInterface $container ): BillingCycleFactory { + 'api.factory.billing-cycle' => static function ( ContainerInterface $container ): BillingCycleFactory { return new BillingCycleFactory( $container->get( 'api.shop.currency.getter' ) ); }, - 'api.factory.payment-preferences' => static function( ContainerInterface $container ):PaymentPreferencesFactory { + 'api.factory.payment-preferences' => static function ( ContainerInterface $container ): PaymentPreferencesFactory { return new PaymentPreferencesFactory( $container->get( 'api.shop.currency.getter' ) ); }, - 'api.factory.plan' => static function( ContainerInterface $container ): PlanFactory { + 'api.factory.plan' => static function ( ContainerInterface $container ): PlanFactory { return new PlanFactory( $container->get( 'api.factory.billing-cycle' ), $container->get( 'api.factory.payment-preferences' ) ); }, - 'api.factory.card-authentication-result-factory' => static function( ContainerInterface $container ): CardAuthenticationResultFactory { + 'api.factory.card-authentication-result-factory' => static function ( ContainerInterface $container ): CardAuthenticationResultFactory { return new CardAuthenticationResultFactory(); }, - 'api.helpers.dccapplies' => static function ( ContainerInterface $container ) : DccApplies { + 'api.helpers.dccapplies' => static function ( ContainerInterface $container ): DccApplies { return new DccApplies( $container->get( 'api.dcc-supported-country-currency-matrix' ), $container->get( 'api.dcc-supported-country-card-matrix' ), @@ -512,21 +512,21 @@ return array( ); }, - 'api.shop.currency.getter' => static function ( ContainerInterface $container ) : CurrencyGetter { + 'api.shop.currency.getter' => static function ( ContainerInterface $container ): CurrencyGetter { return new CurrencyGetter(); }, - 'api.shop.country' => static function ( ContainerInterface $container ) : string { + 'api.shop.country' => static function ( ContainerInterface $container ): string { $location = wc_get_base_location(); return $location['country']; }, - 'api.shop.is-psd2-country' => static function ( ContainerInterface $container ) : bool { + 'api.shop.is-psd2-country' => static function ( ContainerInterface $container ): bool { return in_array( $container->get( 'api.shop.country' ), $container->get( 'api.psd2-countries' ), true ); }, - 'api.shop.is-currency-supported' => static function ( ContainerInterface $container ) : bool { + 'api.shop.is-currency-supported' => static function ( ContainerInterface $container ): bool { return in_array( $container->get( 'api.shop.currency.getter' )->get(), $container->get( 'api.supported-currencies' ), @@ -593,7 +593,7 @@ return array( * * From https://developer.paypal.com/docs/reports/reference/paypal-supported-currencies/ */ - 'api.supported-currencies' => static function ( ContainerInterface $container ) : array { + 'api.supported-currencies' => static function ( ContainerInterface $container ): array { return array( 'AUD', 'BRL', @@ -626,7 +626,7 @@ return array( /** * The matrix which countries and currency combinations can be used for DCC. */ - 'api.dcc-supported-country-currency-matrix' => static function ( ContainerInterface $container ) : array { + 'api.dcc-supported-country-currency-matrix' => static function ( ContainerInterface $container ): array { $default_currencies = apply_filters( 'woocommerce_paypal_payments_supported_currencies', array( @@ -712,7 +712,7 @@ return array( /** * Which countries support which credit cards. Empty credit card arrays mean no restriction on currency. */ - 'api.dcc-supported-country-card-matrix' => static function ( ContainerInterface $container ) : array { + 'api.dcc-supported-country-card-matrix' => static function ( ContainerInterface $container ): array { $mastercard_visa_amex = array( 'mastercard' => array(), 'visa' => array(), @@ -793,7 +793,7 @@ return array( ); }, - 'api.psd2-countries' => static function ( ContainerInterface $container ) : array { + 'api.psd2-countries' => static function ( ContainerInterface $container ): array { return array( 'AT', 'BE', @@ -826,7 +826,7 @@ return array( ); }, - 'api.paylater-countries' => static function ( ContainerInterface $container ) : array { + 'api.paylater-countries' => static function ( ContainerInterface $container ): array { return apply_filters( 'woocommerce_paypal_payments_supported_paylater_countries', array( @@ -840,20 +840,20 @@ return array( ) ); }, - 'api.order-helper' => static function( ContainerInterface $container ): OrderHelper { + 'api.order-helper' => static function ( ContainerInterface $container ): OrderHelper { return new OrderHelper(); }, - 'api.helper.order-transient' => static function( ContainerInterface $container ): OrderTransient { + 'api.helper.order-transient' => static function ( ContainerInterface $container ): OrderTransient { $cache = $container->get( 'api.paypal-bearer-cache' ); $purchase_unit_sanitizer = $container->get( 'api.helper.purchase-unit-sanitizer' ); return new OrderTransient( $cache, $purchase_unit_sanitizer ); }, - 'api.helper.failure-registry' => static function( ContainerInterface $container ): FailureRegistry { + 'api.helper.failure-registry' => static function ( ContainerInterface $container ): FailureRegistry { $cache = new Cache( 'ppcp-paypal-api-status-cache' ); return new FailureRegistry( $cache ); }, 'api.helper.purchase-unit-sanitizer' => SingletonDecorator::make( - static function( ContainerInterface $container ): PurchaseUnitSanitizer { + static function ( ContainerInterface $container ): PurchaseUnitSanitizer { $settings = $container->get( 'wcgateway.settings' ); assert( $settings instanceof Settings ); @@ -862,24 +862,24 @@ return array( return new PurchaseUnitSanitizer( $behavior, $line_name ); } ), - 'api.client-credentials' => static function( ContainerInterface $container ): ClientCredentials { + 'api.client-credentials' => static function ( ContainerInterface $container ): ClientCredentials { return new ClientCredentials( $container->get( 'wcgateway.settings' ) ); }, - 'api.paypal-bearer-cache' => static function( ContainerInterface $container ): Cache { + 'api.paypal-bearer-cache' => static function ( ContainerInterface $container ): Cache { return new Cache( 'ppcp-paypal-bearer' ); }, - 'api.client-credentials-cache' => static function( ContainerInterface $container ): Cache { + 'api.client-credentials-cache' => static function ( ContainerInterface $container ): Cache { return new Cache( 'ppcp-client-credentials-cache' ); }, - 'api.user-id-token-cache' => static function( ContainerInterface $container ): Cache { + 'api.user-id-token-cache' => static function ( ContainerInterface $container ): Cache { return new Cache( 'ppcp-id-token-cache' ); }, - 'api.reference-transaction-status-cache' => static function( ContainerInterface $container ): Cache { + 'api.reference-transaction-status-cache' => static function ( ContainerInterface $container ): Cache { return new Cache( 'ppcp-reference-transaction-status-cache' ); }, - 'api.user-id-token' => static function( ContainerInterface $container ): UserIdToken { + 'api.user-id-token' => static function ( ContainerInterface $container ): UserIdToken { return new UserIdToken( $container->get( 'api.host' ), $container->get( 'woocommerce.logger.woocommerce' ), @@ -887,7 +887,7 @@ return array( $container->get( 'api.user-id-token-cache' ) ); }, - 'api.sdk-client-token' => static function( ContainerInterface $container ): SdkClientToken { + 'api.sdk-client-token' => static function ( ContainerInterface $container ): SdkClientToken { return new SdkClientToken( $container->get( 'api.host' ), $container->get( 'woocommerce.logger.woocommerce' ), @@ -895,39 +895,39 @@ return array( $container->get( 'api.client-credentials-cache' ) ); }, - 'api.paypal-host-production' => static function( ContainerInterface $container ) : string { + 'api.paypal-host-production' => static function ( ContainerInterface $container ): string { return PAYPAL_API_URL; }, - 'api.paypal-host-sandbox' => static function( ContainerInterface $container ) : string { + 'api.paypal-host-sandbox' => static function ( ContainerInterface $container ): string { return PAYPAL_SANDBOX_API_URL; }, - 'api.paypal-website-url-production' => static function( ContainerInterface $container ) : string { + 'api.paypal-website-url-production' => static function ( ContainerInterface $container ): string { return PAYPAL_URL; }, - 'api.paypal-website-url-sandbox' => static function( ContainerInterface $container ) : string { + 'api.paypal-website-url-sandbox' => static function ( ContainerInterface $container ): string { return PAYPAL_SANDBOX_URL; }, - 'api.partner_merchant_id-production' => static function( ContainerInterface $container ) : string { + 'api.partner_merchant_id-production' => static function ( ContainerInterface $container ): string { return CONNECT_WOO_MERCHANT_ID; }, - 'api.partner_merchant_id-sandbox' => static function( ContainerInterface $container ) : string { + 'api.partner_merchant_id-sandbox' => static function ( ContainerInterface $container ): string { return CONNECT_WOO_SANDBOX_MERCHANT_ID; }, - 'api.endpoint.login-seller-production' => static function ( ContainerInterface $container ) : LoginSeller { + 'api.endpoint.login-seller-production' => static function ( ContainerInterface $container ): LoginSeller { return new LoginSeller( $container->get( 'api.paypal-host-production' ), $container->get( 'api.partner_merchant_id-production' ), $container->get( 'woocommerce.logger.woocommerce' ) ); }, - 'api.endpoint.login-seller-sandbox' => static function ( ContainerInterface $container ) : LoginSeller { + 'api.endpoint.login-seller-sandbox' => static function ( ContainerInterface $container ): LoginSeller { return new LoginSeller( $container->get( 'api.paypal-host-sandbox' ), $container->get( 'api.partner_merchant_id-sandbox' ), $container->get( 'woocommerce.logger.woocommerce' ) ); }, - 'api.env.paypal-host' => static function ( ContainerInterface $container ) : EnvironmentConfig { + 'api.env.paypal-host' => static function ( ContainerInterface $container ): EnvironmentConfig { /** * Environment specific API host names. * @@ -939,7 +939,7 @@ return array( $container->get( 'api.paypal-host-sandbox' ) ); }, - 'api.env.endpoint.login-seller' => static function ( ContainerInterface $container ) : EnvironmentConfig { + 'api.env.endpoint.login-seller' => static function ( ContainerInterface $container ): EnvironmentConfig { /** * Environment specific LoginSeller API instances. * @@ -951,7 +951,7 @@ return array( $container->get( 'api.endpoint.login-seller-sandbox' ) ); }, - 'api.env.endpoint.partner-referrals' => static function ( ContainerInterface $container ) : EnvironmentConfig { + 'api.env.endpoint.partner-referrals' => static function ( ContainerInterface $container ): EnvironmentConfig { /** * Environment specific PartnerReferrals API instances. * @@ -981,7 +981,7 @@ return array( return CONNECT_WOO_URL; }, - 'api.helper.partner-attribution' => static function ( ContainerInterface $container ) : PartnerAttribution { + 'api.helper.partner-attribution' => static function ( ContainerInterface $container ): PartnerAttribution { return new PartnerAttribution( 'ppcp_bn_code', array( diff --git a/modules/ppcp-api-client/src/ApiModule.php b/modules/ppcp-api-client/src/ApiModule.php index 031974c06..06a52cad7 100644 --- a/modules/ppcp-api-client/src/ApiModule.php +++ b/modules/ppcp-api-client/src/ApiModule.php @@ -66,7 +66,7 @@ class ApiModule implements ServiceModule, FactoryModule, ExtendingModule, Execut ); add_filter( 'ppcp_create_order_request_body_data', - function( array $data ) use ( $c ) { + function ( array $data ) use ( $c ) { foreach ( ( $data['purchase_units'] ?? array() ) as $purchase_unit_index => $purchase_unit ) { foreach ( ( $purchase_unit['items'] ?? array() ) as $item_index => $item ) { diff --git a/modules/ppcp-api-client/src/Authentication/PayPalBearer.php b/modules/ppcp-api-client/src/Authentication/PayPalBearer.php index 7f176c218..575599938 100644 --- a/modules/ppcp-api-client/src/Authentication/PayPalBearer.php +++ b/modules/ppcp-api-client/src/Authentication/PayPalBearer.php @@ -100,7 +100,7 @@ class PayPalBearer implements Bearer { * @throws RuntimeException When request fails. * @return Token */ - public function bearer() : Token { + public function bearer(): Token { try { $bearer = Token::from_json( (string) $this->cache->get( self::CACHE_KEY ) ); @@ -115,7 +115,7 @@ class PayPalBearer implements Bearer { * * @return string The client ID from settings, or the key defined via constructor. */ - private function get_key() : string { + private function get_key(): string { if ( $this->settings && $this->settings->has( 'client_id' ) @@ -132,7 +132,7 @@ class PayPalBearer implements Bearer { * * @return string The client secret from settings, or the value defined via constructor. */ - private function get_secret() : string { + private function get_secret(): string { if ( $this->settings && $this->settings->has( 'client_secret' ) @@ -150,7 +150,7 @@ class PayPalBearer implements Bearer { * @throws RuntimeException When request fails. * @return Token */ - private function newBearer() : Token { + private function newBearer(): Token { $key = $this->get_key(); $secret = $this->get_secret(); $url = trailingslashit( $this->host ) . 'v1/oauth2/token?grant_type=client_credentials'; diff --git a/modules/ppcp-api-client/src/Endpoint/BillingSubscriptions.php b/modules/ppcp-api-client/src/Endpoint/BillingSubscriptions.php index 281afe0ec..1d17da263 100644 --- a/modules/ppcp-api-client/src/Endpoint/BillingSubscriptions.php +++ b/modules/ppcp-api-client/src/Endpoint/BillingSubscriptions.php @@ -65,7 +65,7 @@ class BillingSubscriptions { * @throws RuntimeException If the request fails. * @throws PayPalApiException If the request fails. */ - public function suspend( string $id ):void { + public function suspend( string $id ): void { $data = array( 'reason' => sprintf( 'Suspended by %s.', is_admin() ? 'merchant' : 'customer' ), ); @@ -214,6 +214,4 @@ class BillingSubscriptions { return $json; } - - } diff --git a/modules/ppcp-api-client/src/Endpoint/PartnersEndpoint.php b/modules/ppcp-api-client/src/Endpoint/PartnersEndpoint.php index a663c70a3..53e141ea7 100644 --- a/modules/ppcp-api-client/src/Endpoint/PartnersEndpoint.php +++ b/modules/ppcp-api-client/src/Endpoint/PartnersEndpoint.php @@ -108,7 +108,7 @@ class PartnersEndpoint { * @return SellerStatus * @throws RuntimeException When request could not be fulfilled. */ - public function seller_status() : SellerStatus { + public function seller_status(): SellerStatus { $url = trailingslashit( $this->host ) . 'v1/customer/partners/' . $this->partner_id . '/merchant-integrations/' . $this->merchant_id; $bearer = $this->bearer->bearer(); $args = array( diff --git a/modules/ppcp-api-client/src/Endpoint/PaymentsEndpoint.php b/modules/ppcp-api-client/src/Endpoint/PaymentsEndpoint.php index 484b89a94..b3ed88bb9 100644 --- a/modules/ppcp-api-client/src/Endpoint/PaymentsEndpoint.php +++ b/modules/ppcp-api-client/src/Endpoint/PaymentsEndpoint.php @@ -203,7 +203,7 @@ class PaymentsEndpoint { * @throws RuntimeException If the request fails. * @throws PayPalApiException If the request fails. */ - public function reauthorize( string $authorization_id, ?Money $amount = null ) : string { + public function reauthorize( string $authorization_id, ?Money $amount = null ): string { $bearer = $this->bearer->bearer(); $url = trailingslashit( $this->host ) . 'v2/payments/authorizations/' . $authorization_id . '/reauthorize'; @@ -249,7 +249,7 @@ class PaymentsEndpoint { * @throws RuntimeException If the request fails. * @throws PayPalApiException If the request fails. */ - public function refund( RefundCapture $refund ) : string { + public function refund( RefundCapture $refund ): string { $bearer = $this->bearer->bearer(); $url = trailingslashit( $this->host ) . 'v2/payments/captures/' . $refund->for_capture()->id() . '/refund'; $args = array( @@ -289,7 +289,7 @@ class PaymentsEndpoint { * @throws RuntimeException If the request fails. * @throws PayPalApiException If the request fails. */ - public function void( Authorization $authorization ) : void { + public function void( Authorization $authorization ): void { $bearer = $this->bearer->bearer(); $url = trailingslashit( $this->host ) . 'v2/payments/authorizations/' . $authorization->id() . '/void'; $args = array( diff --git a/modules/ppcp-api-client/src/Endpoint/WebhookEndpoint.php b/modules/ppcp-api-client/src/Endpoint/WebhookEndpoint.php index 1156dfd86..c532f5197 100644 --- a/modules/ppcp-api-client/src/Endpoint/WebhookEndpoint.php +++ b/modules/ppcp-api-client/src/Endpoint/WebhookEndpoint.php @@ -348,7 +348,7 @@ class WebhookEndpoint { if ( isset( $expected_headers[ $key ] ) ) { $expected_headers[ $key ] = $header; } - }; + } foreach ( $expected_headers as $key => $value ) { if ( ! empty( $value ) ) { diff --git a/modules/ppcp-api-client/src/Entity/Authorization.php b/modules/ppcp-api-client/src/Entity/Authorization.php index 007e12475..9e0d3c960 100644 --- a/modules/ppcp-api-client/src/Entity/Authorization.php +++ b/modules/ppcp-api-client/src/Entity/Authorization.php @@ -86,7 +86,7 @@ class Authorization { * * @return FraudProcessorResponse|null */ - public function fraud_processor_response() : ?FraudProcessorResponse { + public function fraud_processor_response(): ?FraudProcessorResponse { return $this->fraud_processor_response; } diff --git a/modules/ppcp-api-client/src/Entity/Capture.php b/modules/ppcp-api-client/src/Entity/Capture.php index 98543437b..3d85daadd 100644 --- a/modules/ppcp-api-client/src/Entity/Capture.php +++ b/modules/ppcp-api-client/src/Entity/Capture.php @@ -120,7 +120,7 @@ class Capture { * * @return string */ - public function id() : string { + public function id(): string { return $this->id; } @@ -129,7 +129,7 @@ class Capture { * * @return CaptureStatus */ - public function status() : CaptureStatus { + public function status(): CaptureStatus { return $this->status; } @@ -138,7 +138,7 @@ class Capture { * * @return Amount */ - public function amount() : Amount { + public function amount(): Amount { return $this->amount; } @@ -147,7 +147,7 @@ class Capture { * * @return bool */ - public function final_capture() : bool { + public function final_capture(): bool { return $this->final_capture; } @@ -165,7 +165,7 @@ class Capture { * * @return string */ - public function invoice_id() : string { + public function invoice_id(): string { return $this->invoice_id; } @@ -174,7 +174,7 @@ class Capture { * * @return string */ - public function custom_id() : string { + public function custom_id(): string { return $this->custom_id; } @@ -183,7 +183,7 @@ class Capture { * * @return SellerReceivableBreakdown|null */ - public function seller_receivable_breakdown() : ?SellerReceivableBreakdown { + public function seller_receivable_breakdown(): ?SellerReceivableBreakdown { return $this->seller_receivable_breakdown; } @@ -192,7 +192,7 @@ class Capture { * * @return FraudProcessorResponse|null */ - public function fraud_processor_response() : ?FraudProcessorResponse { + public function fraud_processor_response(): ?FraudProcessorResponse { return $this->fraud_processor_response; } @@ -201,7 +201,7 @@ class Capture { * * @return array */ - public function to_array() : array { + public function to_array(): array { $data = array( 'id' => $this->id(), 'status' => $this->status()->name(), diff --git a/modules/ppcp-api-client/src/Entity/Item.php b/modules/ppcp-api-client/src/Entity/Item.php index 90a270cf1..3e75a9512 100644 --- a/modules/ppcp-api-client/src/Entity/Item.php +++ b/modules/ppcp-api-client/src/Entity/Item.php @@ -204,7 +204,7 @@ class Item { * * @return string */ - public function url():string { + public function url(): string { return $this->url; } @@ -213,7 +213,7 @@ class Item { * * @return string */ - public function image_url():string { + public function image_url(): string { return $this->validate_image_url() ? $this->image_url : ''; } @@ -222,7 +222,7 @@ class Item { * * @return float */ - public function tax_rate():float { + public function tax_rate(): float { return round( (float) $this->tax_rate, 2 ); } @@ -231,7 +231,7 @@ class Item { * * @return string|null */ - public function cart_item_key():?string { + public function cart_item_key(): ?string { return $this->cart_item_key; } diff --git a/modules/ppcp-api-client/src/Entity/PaymentPreferences.php b/modules/ppcp-api-client/src/Entity/PaymentPreferences.php index b257c2389..998061ab9 100644 --- a/modules/ppcp-api-client/src/Entity/PaymentPreferences.php +++ b/modules/ppcp-api-client/src/Entity/PaymentPreferences.php @@ -104,7 +104,7 @@ class PaymentPreferences { * * @return array */ - public function to_array():array { + public function to_array(): array { return array( 'setup_fee' => $this->setup_fee(), 'auto_bill_outstanding' => $this->auto_bill_outstanding(), diff --git a/modules/ppcp-api-client/src/Entity/PaymentToken.php b/modules/ppcp-api-client/src/Entity/PaymentToken.php index 65796d6b8..56df4ca1f 100644 --- a/modules/ppcp-api-client/src/Entity/PaymentToken.php +++ b/modules/ppcp-api-client/src/Entity/PaymentToken.php @@ -124,5 +124,4 @@ class PaymentToken { ) ); } - } diff --git a/modules/ppcp-api-client/src/Entity/Plan.php b/modules/ppcp-api-client/src/Entity/Plan.php index 06747776b..f8bc3af35 100644 --- a/modules/ppcp-api-client/src/Entity/Plan.php +++ b/modules/ppcp-api-client/src/Entity/Plan.php @@ -141,7 +141,7 @@ class Plan { * * @return array */ - public function to_array():array { + public function to_array(): array { return array( 'id' => $this->id(), 'name' => $this->name(), diff --git a/modules/ppcp-api-client/src/Entity/Refund.php b/modules/ppcp-api-client/src/Entity/Refund.php index eb44fe00a..8da6806ea 100644 --- a/modules/ppcp-api-client/src/Entity/Refund.php +++ b/modules/ppcp-api-client/src/Entity/Refund.php @@ -119,7 +119,7 @@ class Refund { * * @return string */ - public function id() : string { + public function id(): string { return $this->id; } @@ -128,7 +128,7 @@ class Refund { * * @return RefundStatus */ - public function status() : RefundStatus { + public function status(): RefundStatus { return $this->status; } @@ -137,7 +137,7 @@ class Refund { * * @return Amount */ - public function amount() : Amount { + public function amount(): Amount { return $this->amount; } @@ -146,7 +146,7 @@ class Refund { * * @return string */ - public function invoice_id() : string { + public function invoice_id(): string { return $this->invoice_id; } @@ -155,7 +155,7 @@ class Refund { * * @return string */ - public function custom_id() : string { + public function custom_id(): string { return $this->custom_id; } @@ -164,7 +164,7 @@ class Refund { * * @return SellerPayableBreakdown|null */ - public function seller_payable_breakdown() : ?SellerPayableBreakdown { + public function seller_payable_breakdown(): ?SellerPayableBreakdown { return $this->seller_payable_breakdown; } @@ -173,7 +173,7 @@ class Refund { * * @return string */ - public function acquirer_reference_number() : string { + public function acquirer_reference_number(): string { return $this->acquirer_reference_number; } @@ -182,7 +182,7 @@ class Refund { * * @return string */ - public function note_to_payer() : string { + public function note_to_payer(): string { return $this->note_to_payer; } @@ -191,7 +191,7 @@ class Refund { * * @return RefundPayer|null */ - public function payer() : ?RefundPayer { + public function payer(): ?RefundPayer { return $this->payer; } @@ -200,7 +200,7 @@ class Refund { * * @return array */ - public function to_array() : array { + public function to_array(): array { $data = array( 'id' => $this->id(), 'status' => $this->status()->name(), diff --git a/modules/ppcp-api-client/src/Entity/RefundCapture.php b/modules/ppcp-api-client/src/Entity/RefundCapture.php index cef578a5c..c225141af 100644 --- a/modules/ppcp-api-client/src/Entity/RefundCapture.php +++ b/modules/ppcp-api-client/src/Entity/RefundCapture.php @@ -67,7 +67,7 @@ class RefundCapture { * * @return Capture */ - public function for_capture() : Capture { + public function for_capture(): Capture { return $this->capture; } @@ -76,7 +76,7 @@ class RefundCapture { * * @return string */ - public function invoice_id() : string { + public function invoice_id(): string { return $this->invoice_id; } @@ -85,7 +85,7 @@ class RefundCapture { * * @return string */ - public function note_to_payer() : string { + public function note_to_payer(): string { return $this->note_to_payer; } @@ -103,7 +103,7 @@ class RefundCapture { * * @return array */ - public function to_array() : array { + public function to_array(): array { $data = array( 'invoice_id' => $this->invoice_id(), ); diff --git a/modules/ppcp-api-client/src/Entity/SellerStatus.php b/modules/ppcp-api-client/src/Entity/SellerStatus.php index fd948b276..d23ba0f31 100644 --- a/modules/ppcp-api-client/src/Entity/SellerStatus.php +++ b/modules/ppcp-api-client/src/Entity/SellerStatus.php @@ -68,7 +68,7 @@ class SellerStatus { * * @return SellerStatusProduct[] */ - public function products() : array { + public function products(): array { return $this->products; } @@ -77,7 +77,7 @@ class SellerStatus { * * @return SellerStatusCapability[] */ - public function capabilities() : array { + public function capabilities(): array { return $this->capabilities; } @@ -86,7 +86,7 @@ class SellerStatus { * * @return string */ - public function country() : string { + public function country(): string { return $this->country; } @@ -95,16 +95,16 @@ class SellerStatus { * * @return array */ - public function to_array() : array { + public function to_array(): array { $products = array_map( - function( SellerStatusProduct $product ) : array { + function ( SellerStatusProduct $product ): array { return $product->to_array(); }, $this->products() ); $capabilities = array_map( - function( SellerStatusCapability $capability ) : array { + function ( SellerStatusCapability $capability ): array { return $capability->to_array(); }, $this->capabilities() diff --git a/modules/ppcp-api-client/src/Entity/SellerStatusCapability.php b/modules/ppcp-api-client/src/Entity/SellerStatusCapability.php index 7fdb7df04..02b7caec7 100644 --- a/modules/ppcp-api-client/src/Entity/SellerStatusCapability.php +++ b/modules/ppcp-api-client/src/Entity/SellerStatusCapability.php @@ -49,7 +49,7 @@ class SellerStatusCapability { * * @return string */ - public function name() : string { + public function name(): string { return $this->name; } @@ -58,7 +58,7 @@ class SellerStatusCapability { * * @return string */ - public function status() : string { + public function status(): string { return $this->status; } @@ -67,11 +67,10 @@ class SellerStatusCapability { * * @return array */ - public function to_array() : array { + public function to_array(): array { return array( 'name' => $this->name(), 'status' => $this->status(), ); } - } diff --git a/modules/ppcp-api-client/src/Entity/SellerStatusProduct.php b/modules/ppcp-api-client/src/Entity/SellerStatusProduct.php index 3dd4d7129..b1818472a 100644 --- a/modules/ppcp-api-client/src/Entity/SellerStatusProduct.php +++ b/modules/ppcp-api-client/src/Entity/SellerStatusProduct.php @@ -69,7 +69,7 @@ class SellerStatusProduct { * * @return string */ - public function name() : string { + public function name(): string { return $this->name; } @@ -78,7 +78,7 @@ class SellerStatusProduct { * * @return string */ - public function vetting_status() : string { + public function vetting_status(): string { return $this->vetting_status; } @@ -87,7 +87,7 @@ class SellerStatusProduct { * * @return string[] */ - public function capabilities() : array { + public function capabilities(): array { return $this->capabilities; } @@ -96,13 +96,11 @@ class SellerStatusProduct { * * @return array */ - public function to_array() : array { + public function to_array(): array { return array( 'name' => $this->name(), 'vetting_status' => $this->vetting_status(), 'capabilities' => $this->capabilities(), ); } - - } diff --git a/modules/ppcp-api-client/src/Entity/Shipping.php b/modules/ppcp-api-client/src/Entity/Shipping.php index 9623e006a..2fc8ea38c 100644 --- a/modules/ppcp-api-client/src/Entity/Shipping.php +++ b/modules/ppcp-api-client/src/Entity/Shipping.php @@ -91,7 +91,7 @@ class Shipping { * * @return null|string */ - public function email_address() : ?string { + public function email_address(): ?string { return $this->email_address; } @@ -100,7 +100,7 @@ class Shipping { * * @return null|Phone */ - public function phone_number() : ?Phone { + public function phone_number(): ?Phone { return $this->phone_number; } diff --git a/modules/ppcp-api-client/src/Factory/CaptureFactory.php b/modules/ppcp-api-client/src/Factory/CaptureFactory.php index 7f479f30e..60e490f53 100644 --- a/modules/ppcp-api-client/src/Factory/CaptureFactory.php +++ b/modules/ppcp-api-client/src/Factory/CaptureFactory.php @@ -66,7 +66,7 @@ class CaptureFactory { * @return Capture * @throws RuntimeException When capture amount data is invalid. */ - public function from_paypal_response( \stdClass $data ) : Capture { + public function from_paypal_response( \stdClass $data ): Capture { $reason = $data->status_details->reason ?? null; $seller_receivable_breakdown = isset( $data->seller_receivable_breakdown ) ? $this->seller_receivable_breakdown_factory->from_paypal_response( $data->seller_receivable_breakdown ) diff --git a/modules/ppcp-api-client/src/Factory/ContactPreferenceFactory.php b/modules/ppcp-api-client/src/Factory/ContactPreferenceFactory.php index 286297ae8..86483c715 100644 --- a/modules/ppcp-api-client/src/Factory/ContactPreferenceFactory.php +++ b/modules/ppcp-api-client/src/Factory/ContactPreferenceFactory.php @@ -48,7 +48,7 @@ class ContactPreferenceFactory { * @param string $payment_source_key Name of the payment_source. * @return string|null */ - public function from_state( string $payment_source_key ) : ?string { + public function from_state( string $payment_source_key ): ?string { $payment_sources_with_contact = array( 'paypal', 'venmo' ); /** diff --git a/modules/ppcp-api-client/src/Factory/ExperienceContextBuilder.php b/modules/ppcp-api-client/src/Factory/ExperienceContextBuilder.php index 9d826e365..3c3f4c090 100644 --- a/modules/ppcp-api-client/src/Factory/ExperienceContextBuilder.php +++ b/modules/ppcp-api-client/src/Factory/ExperienceContextBuilder.php @@ -214,7 +214,7 @@ class ExperienceContextBuilder { * * @param string|null $preference The new preference to apply. */ - public function with_contact_preference( ?string $preference = null ) : ExperienceContextBuilder { + public function with_contact_preference( ?string $preference = null ): ExperienceContextBuilder { $builder = clone $this; $builder->experience_context = $builder->experience_context diff --git a/modules/ppcp-api-client/src/Factory/PatchCollectionFactory.php b/modules/ppcp-api-client/src/Factory/PatchCollectionFactory.php index 6eed34a38..122d4b805 100644 --- a/modules/ppcp-api-client/src/Factory/PatchCollectionFactory.php +++ b/modules/ppcp-api-client/src/Factory/PatchCollectionFactory.php @@ -53,7 +53,7 @@ class PatchCollectionFactory { $from, static function ( PurchaseUnit $unit ) use ( $purchase_unit_to ): bool { // Loose comparison needed to compare two objects. - // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison + // phpcs:ignore Universal.Operators.StrictComparisons.LooseEqual return $unit == $purchase_unit_to; } ) diff --git a/modules/ppcp-api-client/src/Factory/PaymentPreferencesFactory.php b/modules/ppcp-api-client/src/Factory/PaymentPreferencesFactory.php index 692471b5d..043945e33 100644 --- a/modules/ppcp-api-client/src/Factory/PaymentPreferencesFactory.php +++ b/modules/ppcp-api-client/src/Factory/PaymentPreferencesFactory.php @@ -41,7 +41,7 @@ class PaymentPreferencesFactory { * @param WC_Product $product WC product. * @return PaymentPreferences */ - public function from_wc_product( WC_Product $product ):PaymentPreferences { + public function from_wc_product( WC_Product $product ): PaymentPreferences { return new PaymentPreferences( array( 'value' => $product->get_meta( '_subscription_sign_up_fee' ) ?: '0', diff --git a/modules/ppcp-api-client/src/Factory/PurchaseUnitFactory.php b/modules/ppcp-api-client/src/Factory/PurchaseUnitFactory.php index fa9348528..b6ea5e431 100644 --- a/modules/ppcp-api-client/src/Factory/PurchaseUnitFactory.php +++ b/modules/ppcp-api-client/src/Factory/PurchaseUnitFactory.php @@ -175,7 +175,8 @@ class PurchaseUnitFactory { $shipping = null; $customer = \WC()->customer; - if ( $this->shipping_needed( ... array_values( $items ) ) && is_a( $customer, \WC_Customer::class ) ) { + /** @psalm-suppress RedundantConditionGivenDocblockType False positive. Ignored because $customer can be null as well. */ + if ( $this->shipping_needed( ...array_values( $items ) ) && is_a( $customer, \WC_Customer::class ) ) { $shipping = $this->shipping_factory->from_wc_customer( \WC()->customer, $with_shipping_options ); $shipping_address = $shipping->address(); if ( @@ -254,7 +255,7 @@ class PurchaseUnitFactory { $shipping = $this->shipping_factory->from_paypal_response( $data->shipping ); } } catch ( RuntimeException $error ) { - ; + $shipping = null; } $payments = null; try { @@ -262,7 +263,7 @@ class PurchaseUnitFactory { $payments = $this->payments_factory->from_paypal_response( $data->payments ); } } catch ( RuntimeException $error ) { - ; + $payments = null; } $purchase_unit = new PurchaseUnit( @@ -333,7 +334,7 @@ class PurchaseUnitFactory { * * @return string The sanitized soft descriptor. */ - private function sanitize_soft_descriptor( string $soft_descriptor ) : string { + private function sanitize_soft_descriptor( string $soft_descriptor ): string { $decoded = html_entity_decode( $soft_descriptor, ENT_QUOTES, 'UTF-8' ); $sanitized = preg_replace( '/[^a-zA-Z0-9 *\-.]/', '', $decoded ) ?: ''; @@ -349,9 +350,9 @@ class PurchaseUnitFactory { * @return bool */ private function should_disable_shipping( array $items, ?Address $shipping_address ): bool { - return ! $this->shipping_needed( ... array_values( $items ) ) || - ! $shipping_address || - empty( $shipping_address->country_code() ) || - ( ! $shipping_address->postal_code() && ! $this->country_without_postal_code( $shipping_address->country_code() ) ); + return ! $this->shipping_needed( ...array_values( $items ) ) || + ! $shipping_address || + empty( $shipping_address->country_code() ) || + ( ! $shipping_address->postal_code() && ! $this->country_without_postal_code( $shipping_address->country_code() ) ); } } diff --git a/modules/ppcp-api-client/src/Factory/RefundFactory.php b/modules/ppcp-api-client/src/Factory/RefundFactory.php index e9cbbe542..4d7e8aeb6 100644 --- a/modules/ppcp-api-client/src/Factory/RefundFactory.php +++ b/modules/ppcp-api-client/src/Factory/RefundFactory.php @@ -65,7 +65,7 @@ class RefundFactory { * @return Refund * @throws RuntimeException When refund amount data is invalid. */ - public function from_paypal_response( \stdClass $data ) : Refund { + public function from_paypal_response( \stdClass $data ): Refund { $reason = $data->status_details->reason ?? null; $seller_payable_breakdown = isset( $data->seller_payable_breakdown ) ? $this->seller_payable_breakdown_factory->from_paypal_response( $data->seller_payable_breakdown ) diff --git a/modules/ppcp-api-client/src/Factory/SellerStatusFactory.php b/modules/ppcp-api-client/src/Factory/SellerStatusFactory.php index 4182b5815..2dfe828d6 100644 --- a/modules/ppcp-api-client/src/Factory/SellerStatusFactory.php +++ b/modules/ppcp-api-client/src/Factory/SellerStatusFactory.php @@ -25,9 +25,9 @@ class SellerStatusFactory { * * @return SellerStatus */ - public function from_paypal_response( \stdClass $json ) : SellerStatus { + public function from_paypal_response( \stdClass $json ): SellerStatus { $products = array_map( - function( $json ) : SellerStatusProduct { + function ( $json ): SellerStatusProduct { $product = new SellerStatusProduct( isset( $json->name ) ? (string) $json->name : '', isset( $json->vetting_status ) ? (string) $json->vetting_status : '', @@ -39,7 +39,7 @@ class SellerStatusFactory { ); $capabilities = array_map( - function( $json ) : SellerStatusCapability { + function ( $json ): SellerStatusCapability { $capability = new SellerStatusCapability( isset( $json->name ) ? (string) $json->name : '', isset( $json->status ) ? (string) $json->status : '' diff --git a/modules/ppcp-api-client/src/Helper/Cache.php b/modules/ppcp-api-client/src/Helper/Cache.php index e77f78825..7454ea160 100644 --- a/modules/ppcp-api-client/src/Helper/Cache.php +++ b/modules/ppcp-api-client/src/Helper/Cache.php @@ -48,7 +48,7 @@ class Cache { * * @return bool */ - public function has( string $key ) : bool { + public function has( string $key ): bool { $value = $this->get( $key ); return false !== $value; @@ -59,7 +59,7 @@ class Cache { * * @param string $key The key. */ - public function delete( string $key ) : void { + public function delete( string $key ): void { delete_transient( $this->prefix . $key ); } @@ -72,7 +72,7 @@ class Cache { * * @return bool */ - public function set( string $key, $value, int $expiration = 0 ) : bool { + public function set( string $key, $value, int $expiration = 0 ): bool { return (bool) set_transient( $this->prefix . $key, $value, $expiration ); } @@ -81,7 +81,7 @@ class Cache { * * @return void */ - public function flush() : void { + public function flush(): void { global $wpdb; // Get a list of all transients with the relevant "group prefix" from the DB. diff --git a/modules/ppcp-api-client/src/Helper/DccApplies.php b/modules/ppcp-api-client/src/Helper/DccApplies.php index 8f8a1c942..94f09c6cf 100644 --- a/modules/ppcp-api-client/src/Helper/DccApplies.php +++ b/modules/ppcp-api-client/src/Helper/DccApplies.php @@ -94,7 +94,7 @@ class DccApplies { * * @return array */ - public function valid_cards() : array { + public function valid_cards(): array { $cards = array(); if ( ! isset( $this->country_card_matrix[ $this->country ] ) ) { return $cards; @@ -122,7 +122,7 @@ class DccApplies { * * @return bool */ - public function can_process_card( string $card ) : bool { + public function can_process_card( string $card ): bool { if ( ! isset( $this->country_card_matrix[ $this->country ] ) ) { return false; } diff --git a/modules/ppcp-api-client/src/Helper/FailureRegistry.php b/modules/ppcp-api-client/src/Helper/FailureRegistry.php index 68889b13c..6dda4b984 100644 --- a/modules/ppcp-api-client/src/Helper/FailureRegistry.php +++ b/modules/ppcp-api-client/src/Helper/FailureRegistry.php @@ -90,5 +90,4 @@ class FailureRegistry { private function cache_key( string $key ): string { return implode( '_', array( self::CACHE_KEY, $key ) ); } - } diff --git a/modules/ppcp-api-client/src/Helper/OrderTransient.php b/modules/ppcp-api-client/src/Helper/OrderTransient.php index efe980928..c802cf331 100644 --- a/modules/ppcp-api-client/src/Helper/OrderTransient.php +++ b/modules/ppcp-api-client/src/Helper/OrderTransient.php @@ -156,5 +156,4 @@ class OrderTransient { } return implode( '_', array( self::CACHE_KEY . $order->id() ) ); } - } diff --git a/modules/ppcp-api-client/src/Helper/PartnerAttribution.php b/modules/ppcp-api-client/src/Helper/PartnerAttribution.php index 35e1cfc4a..740d18fdd 100644 --- a/modules/ppcp-api-client/src/Helper/PartnerAttribution.php +++ b/modules/ppcp-api-client/src/Helper/PartnerAttribution.php @@ -63,7 +63,7 @@ class PartnerAttribution { * @param string $installation_path The installation path used to determine the BN Code. * @param bool $force_update Whether to force an update of the BN code if it already exists. */ - public function initialize_bn_code( string $installation_path, bool $force_update = false ) : void { + public function initialize_bn_code( string $installation_path, bool $force_update = false ): void { $selected_bn_code = $this->bn_codes[ $installation_path ] ?? ''; if ( ! $selected_bn_code ) { return; @@ -82,7 +82,7 @@ class PartnerAttribution { * * @return string The stored BN Code, or the default value if no path is detected. */ - public function get_bn_code() : string { + public function get_bn_code(): string { $bn_code = (string) ( get_option( $this->bn_code_option_name, $this->default_bn_code ) ?? $this->default_bn_code ); if ( ! in_array( $bn_code, $this->bn_codes, true ) ) { diff --git a/modules/ppcp-api-client/src/Helper/ProductStatus.php b/modules/ppcp-api-client/src/Helper/ProductStatus.php index 0c29db33d..9f2e2e096 100644 --- a/modules/ppcp-api-client/src/Helper/ProductStatus.php +++ b/modules/ppcp-api-client/src/Helper/ProductStatus.php @@ -93,7 +93,7 @@ abstract class ProductStatus { * @throws RuntimeException When the check failed. * @throws NotFoundException When a relevant service or setting was not found. */ - abstract protected function check_local_state() : ?bool; + abstract protected function check_local_state(): ?bool; /** * Inspects the API response of the SellerStatus to determine feature eligibility. @@ -105,7 +105,7 @@ abstract class ProductStatus { * @return bool * @throws RuntimeException When the check failed. */ - abstract protected function check_active_state( SellerStatus $seller_status ) : bool; + abstract protected function check_active_state( SellerStatus $seller_status ): bool; /** * Clears the eligibility status from the local cache/DB to enforce a new @@ -114,14 +114,14 @@ abstract class ProductStatus { * @param Settings|null $settings See description in {@see self::clear()}. * @return void */ - abstract protected function clear_state( ?Settings $settings = null ) : void; + abstract protected function clear_state( ?Settings $settings = null ): void; /** * Whether the merchant has access to the feature. * * @return bool */ - public function is_active() : bool { + public function is_active(): bool { if ( null !== $this->is_eligible ) { return $this->is_eligible; } @@ -158,7 +158,7 @@ abstract class ProductStatus { * @return SellerStatus * @throws RuntimeException When the check failed. */ - protected function get_seller_status_object() : SellerStatus { + protected function get_seller_status_object(): SellerStatus { if ( null === self::$seller_status ) { // Check API failure registry to prevent multiple failed API requests. if ( $this->api_failure_registry->has_failure_in_timeframe( FailureRegistry::SELLER_STATUS_KEY, MINUTE_IN_SECONDS ) ) { @@ -177,7 +177,7 @@ abstract class ProductStatus { * * @return bool True, if we can use the merchant API endpoints. */ - public function is_onboarded() : bool { + public function is_onboarded(): bool { return $this->is_connected; } @@ -186,7 +186,7 @@ abstract class ProductStatus { * * @return bool */ - public function has_request_failure() : bool { + public function has_request_failure(): bool { return $this->has_request_failure; } @@ -199,7 +199,7 @@ abstract class ProductStatus { * @param Settings|null $settings The settings object. * @return void */ - public function clear( ?Settings $settings = null ) : void { + public function clear( ?Settings $settings = null ): void { $this->is_eligible = null; $this->has_request_failure = false; diff --git a/modules/ppcp-api-client/src/Helper/PurchaseUnitSanitizer.php b/modules/ppcp-api-client/src/Helper/PurchaseUnitSanitizer.php index b5cd133b6..a4af724a3 100644 --- a/modules/ppcp-api-client/src/Helper/PurchaseUnitSanitizer.php +++ b/modules/ppcp-api-client/src/Helper/PurchaseUnitSanitizer.php @@ -393,5 +393,4 @@ class PurchaseUnitSanitizer { public function set_last_message( string $message ): void { $this->last_message = $message; } - } diff --git a/modules/ppcp-api-client/src/Repository/PartnerReferralsData.php b/modules/ppcp-api-client/src/Repository/PartnerReferralsData.php index 40f51326b..93467ce75 100644 --- a/modules/ppcp-api-client/src/Repository/PartnerReferralsData.php +++ b/modules/ppcp-api-client/src/Repository/PartnerReferralsData.php @@ -40,7 +40,7 @@ class PartnerReferralsData { * * @return string */ - public function nonce() : string { + public function nonce(): string { return 'a1233wtergfsdt4365tzrshgfbaewa36AGa1233wtergfsdt4365tzrshgfbaewa36AG'; } @@ -59,7 +59,7 @@ class PartnerReferralsData { string $onboarding_token = '', ?bool $use_subscriptions = null, bool $use_card_payments = true - ) : array { + ): array { $in_acdc_country = $this->dcc_applies->for_country_currency(); if ( ! $products ) { diff --git a/modules/ppcp-applepay/services.php b/modules/ppcp-applepay/services.php index add3c14c3..4f832480b 100644 --- a/modules/ppcp-applepay/services.php +++ b/modules/ppcp-applepay/services.php @@ -33,11 +33,11 @@ return array( $apm_applies = $container->get( 'applepay.helpers.apm-applies' ); assert( $apm_applies instanceof ApmApplies ); - return static function () use ( $apm_applies ) : bool { + return static function () use ( $apm_applies ): bool { return $apm_applies->for_country() && $apm_applies->for_currency() && $apm_applies->for_merchant(); }; }, - 'applepay.helpers.apm-applies' => static function ( ContainerInterface $container ) : ApmApplies { + 'applepay.helpers.apm-applies' => static function ( ContainerInterface $container ): ApmApplies { return new ApmApplies( $container->get( 'applepay.supported-countries' ), $container->get( 'applepay.supported-currencies' ), @@ -45,7 +45,7 @@ return array( $container->get( 'api.shop.country' ) ); }, - 'applepay.status-cache' => static function( ContainerInterface $container ): Cache { + 'applepay.status-cache' => static function ( ContainerInterface $container ): Cache { return new Cache( 'ppcp-paypal-apple-status-cache' ); }, @@ -82,7 +82,7 @@ return array( }, 'applepay.apple-product-status' => SingletonDecorator::make( - static function( ContainerInterface $container ): AppleProductStatus { + static function ( ContainerInterface $container ): AppleProductStatus { return new AppleProductStatus( $container->get( 'wcgateway.settings' ), $container->get( 'api.endpoint.partners' ), @@ -169,7 +169,7 @@ return array( /** * The list of which countries can be used for ApplePay. */ - 'applepay.supported-countries' => static function ( ContainerInterface $container ) : array { + 'applepay.supported-countries' => static function ( ContainerInterface $container ): array { /** * Returns which countries can be used for ApplePay. */ @@ -225,7 +225,7 @@ return array( /** * The list of which currencies can be used for ApplePay. */ - 'applepay.supported-currencies' => static function ( ContainerInterface $container ) : array { + 'applepay.supported-currencies' => static function ( ContainerInterface $container ): array { /** * Returns which currencies can be used for ApplePay. */ diff --git a/modules/ppcp-applepay/src/ApplePayGateway.php b/modules/ppcp-applepay/src/ApplePayGateway.php index f7b1d2959..b84f0f414 100644 --- a/modules/ppcp-applepay/src/ApplePayGateway.php +++ b/modules/ppcp-applepay/src/ApplePayGateway.php @@ -171,7 +171,7 @@ class ApplePayGateway extends WC_Payment_Gateway { * * @return array */ - public function process_payment( $order_id ) : array { + public function process_payment( $order_id ): array { $wc_order = wc_get_order( $order_id ); if ( ! is_a( $wc_order, WC_Order::class ) ) { return $this->handle_payment_failure( @@ -234,7 +234,7 @@ class ApplePayGateway extends WC_Payment_Gateway { * * @return boolean True or false based on success, or a WP_Error object. */ - public function process_refund( $order_id, $amount = null, $reason = '' ) : bool { + public function process_refund( $order_id, $amount = null, $reason = '' ): bool { $order = wc_get_order( $order_id ); if ( ! is_a( $order, WC_Order::class ) ) { return false; @@ -250,7 +250,7 @@ class ApplePayGateway extends WC_Payment_Gateway { * * @return string */ - public function get_transaction_url( $order ) : string { + public function get_transaction_url( $order ): string { $this->view_transaction_url = $this->transaction_url_provider->get_transaction_url_base( $order ); return parent::get_transaction_url( $order ); diff --git a/modules/ppcp-applepay/src/ApplepayModule.php b/modules/ppcp-applepay/src/ApplepayModule.php index f02aabc29..49f70bfe6 100644 --- a/modules/ppcp-applepay/src/ApplepayModule.php +++ b/modules/ppcp-applepay/src/ApplepayModule.php @@ -56,7 +56,7 @@ class ApplepayModule implements ServiceModule, ExtendingModule, ExecutableModule // Clears product status when appropriate. add_action( 'woocommerce_paypal_payments_clear_apm_product_status', - function( ?Settings $settings = null ) use ( $c ): void { + function ( ?Settings $settings = null ) use ( $c ): void { $apm_status = $c->get( 'applepay.apple-product-status' ); assert( $apm_status instanceof AppleProductStatus ); $apm_status->clear( $settings ); @@ -174,7 +174,7 @@ class ApplepayModule implements ServiceModule, ExtendingModule, ExecutableModule add_filter( 'woocommerce_paypal_payments_selected_button_locations', - function( array $locations, string $setting_name ): array { + function ( array $locations, string $setting_name ): array { $gateway = WC()->payment_gateways()->payment_gateways()[ ApplePayGateway::ID ] ?? ''; if ( $gateway && $gateway->enabled === 'yes' && $setting_name === 'smart_button_locations' ) { $locations[] = 'checkout'; @@ -188,7 +188,7 @@ class ApplepayModule implements ServiceModule, ExtendingModule, ExecutableModule add_filter( 'woocommerce_paypal_payments_rest_common_merchant_features', - function( array $features ) use ( $c ): array { + function ( array $features ) use ( $c ): array { $product_status = $c->get( 'applepay.apple-product-status' ); assert( $product_status instanceof AppleProductStatus ); @@ -204,7 +204,7 @@ class ApplepayModule implements ServiceModule, ExtendingModule, ExecutableModule add_filter( 'ppcp_create_order_request_body_data', - static function ( array $data, string $payment_method, array $request ) use ( $c ) : array { + static function ( array $data, string $payment_method, array $request ) use ( $c ): array { if ( $payment_method !== ApplePayGateway::ID ) { return $data; @@ -294,7 +294,7 @@ class ApplepayModule implements ServiceModule, ExtendingModule, ExecutableModule add_action( 'woocommerce_blocks_payment_method_type_registration', - function( PaymentMethodRegistry $payment_method_registry ) use ( $c ): void { + function ( PaymentMethodRegistry $payment_method_registry ) use ( $c ): void { $payment_method_registry->register( $c->get( 'applepay.blocks-payment-method' ) ); } ); @@ -329,7 +329,7 @@ class ApplepayModule implements ServiceModule, ExtendingModule, ExecutableModule // Adds ApplePay component to the backend button preview settings. add_action( 'woocommerce_paypal_payments_admin_gateway_settings', - function( array $settings ) use ( $c ): array { + function ( array $settings ) use ( $c ): array { if ( is_array( $settings['components'] ) ) { $settings['components'][] = 'applepay'; } @@ -412,7 +412,7 @@ class ApplepayModule implements ServiceModule, ExtendingModule, ExecutableModule * @param bool $is_sandbox The environment for this merchant. * @return string */ - public function validation_string( bool $is_sandbox ) : string { + public function validation_string( bool $is_sandbox ): string { $sandbox_string = $this->sandbox_validation_string(); $live_string = $this->live_validation_string(); return $is_sandbox ? $sandbox_string : $live_string; diff --git a/modules/ppcp-applepay/src/Assets/ApplePayButton.php b/modules/ppcp-applepay/src/Assets/ApplePayButton.php index 045c234cb..47c39842c 100644 --- a/modules/ppcp-applepay/src/Assets/ApplePayButton.php +++ b/modules/ppcp-applepay/src/Assets/ApplePayButton.php @@ -26,7 +26,8 @@ use WooCommerce\PayPalCommerce\Button\Helper\ContextTrait; * Class ApplePayButton */ class ApplePayButton implements ButtonInterface { - use RequestHandlerTrait, ContextTrait; + use RequestHandlerTrait; + use ContextTrait; /** * The settings. @@ -222,7 +223,6 @@ class ApplePayButton implements ButtonInterface { return $options . '
'; - } /** @@ -445,7 +445,7 @@ class ApplePayButton implements ButtonInterface { } else { add_filter( 'woocommerce_payment_successful_result', - function ( array $result ) use ( $cart, $cart_item_key ) : array { + function ( array $result ) use ( $cart, $cart_item_key ): array { $this->clear_current_cart( $cart, $cart_item_key ); $this->reload_cart( $cart ); return $result; @@ -917,7 +917,7 @@ class ApplePayButton implements ButtonInterface { add_filter( 'woocommerce_paypal_payments_sdk_components_hook', - function( array $components ) { + function ( array $components ) { $components[] = 'applepay'; return $components; } diff --git a/modules/ppcp-applepay/src/Assets/ApplePayDataObjectHttp.php b/modules/ppcp-applepay/src/Assets/ApplePayDataObjectHttp.php index dad4993d5..bc028feb9 100644 --- a/modules/ppcp-applepay/src/Assets/ApplePayDataObjectHttp.php +++ b/modules/ppcp-applepay/src/Assets/ApplePayDataObjectHttp.php @@ -361,7 +361,6 @@ class ApplePayDataObjectHttp { } $this->$key = $value; } - } /** @@ -509,7 +508,7 @@ class ApplePayDataObjectHttp { * @param array $data The data. * @return void */ - protected function update_simplified_contact( array $data ) : void { + protected function update_simplified_contact( array $data ): void { $simplified_contact_info = array_map( 'sanitize_text_field', $data ); $this->simplified_contact = $this->simplified_address( $simplified_contact_info @@ -727,7 +726,7 @@ class ApplePayDataObjectHttp { * * @return bool */ - public function is_nonce_valid():bool { + public function is_nonce_valid(): bool { $nonce = filter_input( INPUT_POST, 'woocommerce-process-checkout-nonce', FILTER_SANITIZE_SPECIAL_CHARS ); if ( ! $nonce ) { return false; diff --git a/modules/ppcp-applepay/src/Assets/AppleProductStatus.php b/modules/ppcp-applepay/src/Assets/AppleProductStatus.php index 2ffa6fbf6..096be051d 100644 --- a/modules/ppcp-applepay/src/Assets/AppleProductStatus.php +++ b/modules/ppcp-applepay/src/Assets/AppleProductStatus.php @@ -54,7 +54,7 @@ class AppleProductStatus extends ProductStatus { } /** {@inheritDoc} */ - protected function check_local_state() : ?bool { + protected function check_local_state(): ?bool { $status_override = apply_filters( 'woocommerce_paypal_payments_apple_pay_product_status', null ); if ( null !== $status_override ) { return $status_override; @@ -68,7 +68,7 @@ class AppleProductStatus extends ProductStatus { } /** {@inheritDoc} */ - protected function check_active_state( SellerStatus $seller_status ) : bool { + protected function check_active_state( SellerStatus $seller_status ): bool { // Check the seller status for the intended capability. $has_capability = false; foreach ( $seller_status->products() as $product ) { @@ -101,7 +101,7 @@ class AppleProductStatus extends ProductStatus { } /** {@inheritDoc} */ - protected function clear_state( ?Settings $settings = null ) : void { + protected function clear_state( ?Settings $settings = null ): void { if ( null === $settings ) { $settings = $this->settings; } diff --git a/modules/ppcp-applepay/src/Assets/DataToAppleButtonScripts.php b/modules/ppcp-applepay/src/Assets/DataToAppleButtonScripts.php index 52663a4f0..b08d18348 100644 --- a/modules/ppcp-applepay/src/Assets/DataToAppleButtonScripts.php +++ b/modules/ppcp-applepay/src/Assets/DataToAppleButtonScripts.php @@ -49,7 +49,7 @@ class DataToAppleButtonScripts { * * @return array */ - public function apple_pay_script_data() : array { + public function apple_pay_script_data(): array { if ( is_product() ) { return $this->data_for_product_page(); } @@ -62,7 +62,7 @@ class DataToAppleButtonScripts { * * @return array */ - public function apple_pay_script_data_for_admin() : array { + public function apple_pay_script_data_for_admin(): array { return $this->data_for_admin_page(); } @@ -73,7 +73,7 @@ class DataToAppleButtonScripts { * * @return array */ - private function get_apple_pay_data( array $product = array() ) : array { + private function get_apple_pay_data( array $product = array() ): array { // true: Use Apple Pay as distinct gateway. // false: integrate it with the smart buttons. $available_gateways = WC()->payment_gateways->get_available_payment_gateways(); @@ -132,7 +132,7 @@ class DataToAppleButtonScripts { * * @return bool */ - protected function check_if_need_shipping( WC_Product $product ) : bool { + protected function check_if_need_shipping( WC_Product $product ): bool { if ( ! wc_shipping_enabled() || 0 === wc_get_shipping_method_count( @@ -154,7 +154,7 @@ class DataToAppleButtonScripts { * * @return array */ - protected function data_for_product_page() : array { + protected function data_for_product_page(): array { $product = wc_get_product( get_the_id() ); if ( ! $product ) { return array(); @@ -185,7 +185,7 @@ class DataToAppleButtonScripts { * * @return array */ - protected function data_for_cart_page() : array { + protected function data_for_cart_page(): array { $cart = WC()->cart; if ( ! $cart ) { return array(); @@ -206,7 +206,7 @@ class DataToAppleButtonScripts { * * @return array */ - protected function data_for_admin_page() : array { + protected function data_for_admin_page(): array { $data = $this->get_apple_pay_data( array( 'needShipping' => false, diff --git a/modules/ppcp-applepay/src/Helper/ApmApplies.php b/modules/ppcp-applepay/src/Helper/ApmApplies.php index 332ce7015..933634e9c 100644 --- a/modules/ppcp-applepay/src/Helper/ApmApplies.php +++ b/modules/ppcp-applepay/src/Helper/ApmApplies.php @@ -89,7 +89,7 @@ class ApmApplies { * * @return bool */ - public function for_merchant() : bool { + public function for_merchant(): bool { return apply_filters( 'woocommerce_paypal_payments_is_eligible_for_applepay', true diff --git a/modules/ppcp-applepay/src/Helper/AvailabilityNotice.php b/modules/ppcp-applepay/src/Helper/AvailabilityNotice.php index bbdcde159..1f7adead2 100644 --- a/modules/ppcp-applepay/src/Helper/AvailabilityNotice.php +++ b/modules/ppcp-applepay/src/Helper/AvailabilityNotice.php @@ -141,7 +141,6 @@ class AvailabilityNotice { if ( ! $this->is_merchant_validated ) { $this->add_merchant_not_validated_notice(); } - } /** @@ -287,5 +286,4 @@ class AvailabilityNotice { } ); } - } diff --git a/modules/ppcp-axo-block/module.php b/modules/ppcp-axo-block/module.php index a8321fea1..5d7f0cc15 100644 --- a/modules/ppcp-axo-block/module.php +++ b/modules/ppcp-axo-block/module.php @@ -9,6 +9,6 @@ declare( strict_types = 1 ); namespace WooCommerce\PayPalCommerce\AxoBlock; -return static function () : AxoBlockModule { +return static function (): AxoBlockModule { return new AxoBlockModule(); }; diff --git a/modules/ppcp-axo-block/services.php b/modules/ppcp-axo-block/services.php index 91bd5d63f..89dde7d54 100644 --- a/modules/ppcp-axo-block/services.php +++ b/modules/ppcp-axo-block/services.php @@ -14,13 +14,13 @@ use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; return array( // If AXO Block is configured and onboarded. - 'axoblock.available' => static function ( ContainerInterface $container ) : bool { + 'axoblock.available' => static function ( ContainerInterface $container ): bool { return true; }, - 'axoblock.url' => static function ( ContainerInterface $container ) : string { + 'axoblock.url' => static function ( ContainerInterface $container ): string { return plugins_url( '/modules/ppcp-axo-block/', $container->get( 'ppcp.path-to-plugin-main-file' ) ); }, - 'axoblock.method' => static function ( ContainerInterface $container ) : AxoBlockPaymentMethod { + 'axoblock.method' => static function ( ContainerInterface $container ): AxoBlockPaymentMethod { return new AxoBlockPaymentMethod( $container->get( 'axoblock.url' ), $container->get( 'ppcp.asset-version' ), diff --git a/modules/ppcp-axo-block/src/AxoBlockModule.php b/modules/ppcp-axo-block/src/AxoBlockModule.php index e830784b6..a9ba06497 100644 --- a/modules/ppcp-axo-block/src/AxoBlockModule.php +++ b/modules/ppcp-axo-block/src/AxoBlockModule.php @@ -74,7 +74,7 @@ class AxoBlockModule implements ServiceModule, ExtendingModule, ExecutableModule */ add_filter( 'woocommerce_paypal_payments_sdk_components_hook', - function( $components ) use ( $c ) { + function ( $components ) use ( $c ) { if ( ! $c->has( 'axo.available' ) || ! $c->get( 'axo.available' ) ) { return $components; } @@ -87,7 +87,7 @@ class AxoBlockModule implements ServiceModule, ExtendingModule, ExecutableModule add_action( 'woocommerce_blocks_payment_method_type_registration', - function( PaymentMethodRegistry $payment_method_registry ) use ( $c ): void { + function ( PaymentMethodRegistry $payment_method_registry ) use ( $c ): void { /* * Only register the method if we are not in the admin or the customer is not logged in. */ diff --git a/modules/ppcp-axo-block/src/AxoBlockPaymentMethod.php b/modules/ppcp-axo-block/src/AxoBlockPaymentMethod.php index fb23730b2..5637bdd77 100644 --- a/modules/ppcp-axo-block/src/AxoBlockPaymentMethod.php +++ b/modules/ppcp-axo-block/src/AxoBlockPaymentMethod.php @@ -109,16 +109,16 @@ class AxoBlockPaymentMethod extends AbstractPaymentMethodType { * @param array $supported_country_card_type_matrix The supported country card type matrix for Axo. */ public function __construct( - string $module_url, - string $version, - WC_Payment_Gateway $gateway, - $smart_button, - Settings $settings, - CardPaymentsConfiguration $dcc_configuration, - Environment $environment, - string $wcgateway_module_url, - array $payment_method_selected_map, - array $supported_country_card_type_matrix + string $module_url, + string $version, + WC_Payment_Gateway $gateway, + $smart_button, + Settings $settings, + CardPaymentsConfiguration $dcc_configuration, + Environment $environment, + string $wcgateway_module_url, + array $payment_method_selected_map, + array $supported_country_card_type_matrix ) { $this->name = AxoGateway::ID; $this->module_url = $module_url; @@ -141,14 +141,14 @@ class AxoBlockPaymentMethod extends AbstractPaymentMethodType { /** * {@inheritDoc} */ - public function is_active() : bool { + public function is_active(): bool { return $this->gateway->is_available(); } /** * {@inheritDoc} */ - public function get_payment_method_script_handles() : array { + public function get_payment_method_script_handles(): array { $script_path = 'assets/js/index.js'; $script_asset_path = trailingslashit( $this->module_url ) . 'assets/js/index.asset.php'; $script_asset = file_exists( $script_asset_path ) @@ -199,7 +199,7 @@ class AxoBlockPaymentMethod extends AbstractPaymentMethodType { * * @return array */ - private function script_data() : array { + private function script_data(): array { if ( is_admin() ) { return array(); } diff --git a/modules/ppcp-axo/extensions.php b/modules/ppcp-axo/extensions.php index a834dcb0d..4eea59d0e 100644 --- a/modules/ppcp-axo/extensions.php +++ b/modules/ppcp-axo/extensions.php @@ -18,7 +18,7 @@ return array( 'wcgateway.settings.fields' => function ( array $fields, ContainerInterface $container ): array { - $insert_after = function( array $array, string $key, array $new ): array { + $insert_after = function ( array $array, string $key, array $new ): array { $keys = array_keys( $array ); $index = array_search( $key, $keys, true ); $pos = false === $index ? count( $array ) : $index + 1; diff --git a/modules/ppcp-axo/services.php b/modules/ppcp-axo/services.php index cfe8e325f..4fd2702c1 100644 --- a/modules/ppcp-axo/services.php +++ b/modules/ppcp-axo/services.php @@ -34,11 +34,11 @@ return array( $axo_applies = $container->get( 'axo.service.axo-applies' ); assert( $axo_applies instanceof AxoApplies ); - return static function () use ( $axo_applies ) : bool { + return static function () use ( $axo_applies ): bool { return $axo_applies->for_country_currency() && $axo_applies->for_merchant(); }; }, - 'axo.service.axo-applies' => static function ( ContainerInterface $container ) : AxoApplies { + 'axo.service.axo-applies' => static function ( ContainerInterface $container ): AxoApplies { return new AxoApplies( $container->get( 'axo.supported-country-currency-matrix' ), $container->get( 'api.shop.currency.getter' ), @@ -48,7 +48,7 @@ return array( ); }, - 'axo.helpers.compatibility-checker' => static function ( ContainerInterface $container ) : CompatibilityChecker { + 'axo.helpers.compatibility-checker' => static function ( ContainerInterface $container ): CompatibilityChecker { return new CompatibilityChecker( $container->get( 'axo.fastlane-incompatible-plugin-names' ), $container->get( 'wcgateway.configuration.card-configuration' ) @@ -154,7 +154,7 @@ return array( /** * The matrix which countries and currency combinations can be used for AXO. */ - 'axo.supported-country-currency-matrix' => static function ( ContainerInterface $container ) : array { + 'axo.supported-country-currency-matrix' => static function ( ContainerInterface $container ): array { $matrix = array( 'US' => array( 'AUD', @@ -185,7 +185,7 @@ return array( /** * The matrix which countries and card type combinations can be used for AXO. */ - 'axo.supported-country-card-type-matrix' => static function ( ContainerInterface $container ) : array { + 'axo.supported-country-card-type-matrix' => static function ( ContainerInterface $container ): array { $matrix = array( 'US' => array( 'VISA', @@ -226,42 +226,42 @@ return array( $matrix ); }, - 'axo.settings-conflict-notice' => static function ( ContainerInterface $container ) : string { + 'axo.settings-conflict-notice' => static function ( ContainerInterface $container ): string { $compatibility_checker = $container->get( 'axo.helpers.compatibility-checker' ); assert( $compatibility_checker instanceof CompatibilityChecker ); return $compatibility_checker->generate_settings_conflict_notice(); }, - 'axo.checkout-config-notice' => static function ( ContainerInterface $container ) : string { + 'axo.checkout-config-notice' => static function ( ContainerInterface $container ): string { $compatibility_checker = $container->get( 'axo.helpers.compatibility-checker' ); assert( $compatibility_checker instanceof CompatibilityChecker ); return $compatibility_checker->generate_checkout_notice(); }, - 'axo.checkout-config-notice.raw' => static function ( ContainerInterface $container ) : string { + 'axo.checkout-config-notice.raw' => static function ( ContainerInterface $container ): string { $compatibility_checker = $container->get( 'axo.helpers.compatibility-checker' ); assert( $compatibility_checker instanceof CompatibilityChecker ); return $compatibility_checker->generate_checkout_notice( true ); }, - 'axo.incompatible-plugins-notice' => static function ( ContainerInterface $container ) : string { + 'axo.incompatible-plugins-notice' => static function ( ContainerInterface $container ): string { $settings_notice_generator = $container->get( 'axo.helpers.compatibility-checker' ); assert( $settings_notice_generator instanceof CompatibilityChecker ); return $settings_notice_generator->generate_incompatible_plugins_notice(); }, - 'axo.incompatible-plugins-notice.raw' => static function ( ContainerInterface $container ) : string { + 'axo.incompatible-plugins-notice.raw' => static function ( ContainerInterface $container ): string { $settings_notice_generator = $container->get( 'axo.helpers.compatibility-checker' ); assert( $settings_notice_generator instanceof CompatibilityChecker ); return $settings_notice_generator->generate_incompatible_plugins_notice( true ); }, - 'axo.smart-button-location-notice' => static function ( ContainerInterface $container ) : string { + 'axo.smart-button-location-notice' => static function ( ContainerInterface $container ): string { $dcc_configuration = $container->get( 'wcgateway.configuration.card-configuration' ); assert( $dcc_configuration instanceof CardPaymentsConfiguration ); @@ -310,7 +310,7 @@ return array( * * @returns array