diff --git a/changelog.txt b/changelog.txt index 126fdbba2..5e8b26b3e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -12,6 +12,7 @@ * Enhancement - Pass address details to credit card fields #479 * Enhancement - Improve onboarding notice #465 * Enhancement - Add transaction ID to WC order and order note when refund is received #473 +* Enhancement - Asset caching may cause bugs on upgrades #501 = 1.6.5 - 2022-01-31 = * Fix - Allow guest users to purchase subscription products from checkout page #422 diff --git a/composer.json b/composer.json index f92d4dbff..95a6b1141 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,9 @@ "dhii/containers": "^0.1.0-alpha1", "psr/log": "^1.1", "ralouphie/getallheaders": "^3.0", - "wikimedia/composer-merge-plugin": "^1.4" + "wikimedia/composer-merge-plugin": "^1.4", + "wp-oop/wordpress-interface": "^0.1.0-alpha1", + "dhii/versions": "^0.1.0-alpha1" }, "require-dev": { "woocommerce/woocommerce-sniffs": "^0.1.0", diff --git a/composer.lock b/composer.lock index 1c8ca84eb..f23fe5a12 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": "5ec79a51fc5a2f5576f38dd6e4e87b2d", + "content-hash": "d1d10b7eb9134d3da165ae72ac76f540", "packages": [ { "name": "container-interop/service-provider", @@ -35,10 +35,6 @@ ], "description": "Promoting container interoperability through standard service providers", "homepage": "https://github.com/container-interop/service-provider", - "support": { - "issues": "https://github.com/container-interop/service-provider/issues", - "source": "https://github.com/container-interop/service-provider/tree/master" - }, "time": "2017-09-20T14:13:36+00:00" }, { @@ -148,6 +144,57 @@ ], "time": "2021-10-06T11:13:51+00:00" }, + { + "name": "dhii/human-readable-interface", + "version": "v0.2.0-alpha1", + "source": { + "type": "git", + "url": "https://github.com/Dhii/human-readable-interface.git", + "reference": "2b49d664f117faf72fb7af402ad21c0c27c62b6b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dhii/human-readable-interface/zipball/2b49d664f117faf72fb7af402ad21c0c27c62b6b", + "reference": "2b49d664f117faf72fb7af402ad21c0c27c62b6b", + "shasum": "" + }, + "require": { + "php": "^7.1 | ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0 | ^7.0 | ^8.0 | ^9.0", + "slevomat/coding-standard": "^6.0", + "symfony/polyfill-php80": "^1.19", + "vimeo/psalm": "^3.11.7 | ^4.0" + }, + "suggest": { + "dhii/i18n-interface": "For internationalizing and translating human readable strings.", + "symfony/polyfill-php80": "To add Stringable interface" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Dhii\\Util\\String\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dhii Team", + "email": "development@dhii.co" + } + ], + "description": "Interfaces for human readable string interoperation.", + "time": "2021-03-05T00:36:01+00:00" + }, { "name": "dhii/module-interface", "version": "v0.3.0-alpha2", @@ -194,12 +241,142 @@ } ], "description": "Interfaces for modules", - "support": { - "issues": "https://github.com/Dhii/module-interface/issues", - "source": "https://github.com/Dhii/module-interface/tree/v0.3.0-alpha2" - }, "time": "2021-08-23T08:23:01+00:00" }, + { + "name": "dhii/package-interface", + "version": "v0.1.0-alpha4", + "source": { + "type": "git", + "url": "https://github.com/Dhii/package-interface.git", + "reference": "bcc73f4285eead9b482dbb89662b723abf49298b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dhii/package-interface/zipball/bcc73f4285eead9b482dbb89662b723abf49298b", + "reference": "bcc73f4285eead9b482dbb89662b723abf49298b", + "shasum": "" + }, + "require": { + "dhii/validation-interface": "^0.3-alpha1", + "php": "^7.1 | ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^7.0 | ^8.0 | ^9.0", + "slevomat/coding-standard": "^6.0", + "symfony/polyfill-php80": "^1.19", + "vimeo/psalm": "^4.4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Dhii\\Package\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Ukhanev", + "email": "xedin.unknown@gmail.com" + } + ], + "description": "Interfaces for package-related interop", + "time": "2021-12-08T15:57:36+00:00" + }, + { + "name": "dhii/validation-interface", + "version": "v0.3.0-alpha3", + "source": { + "type": "git", + "url": "https://github.com/Dhii/validation-interface.git", + "reference": "0e73c7bf3d2421ceb79331c60a9bc1b1d5eb65a6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dhii/validation-interface/zipball/0e73c7bf3d2421ceb79331c60a9bc1b1d5eb65a6", + "reference": "0e73c7bf3d2421ceb79331c60a9bc1b1d5eb65a6", + "shasum": "" + }, + "require": { + "php": "^7.1 | ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^7.0 | ^8.0 | ^9.0", + "slevomat/coding-standard": "^6.0", + "symfony/polyfill-mbstring": "1.20", + "symfony/polyfill-php80": "^1.19", + "vimeo/psalm": "^3.11.7 | ^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Dhii\\Validation\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Ukhanev", + "email": "xedin.unknown@gmail.com" + } + ], + "description": "A base interface for validators", + "time": "2021-01-14T16:19:20+00:00" + }, + { + "name": "dhii/versions", + "version": "v0.1.0-alpha3", + "source": { + "type": "git", + "url": "https://github.com/Dhii/versions.git", + "reference": "120b22b248d0b46e41bac93bf3394516c9d55730" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dhii/versions/zipball/120b22b248d0b46e41bac93bf3394516c9d55730", + "reference": "120b22b248d0b46e41bac93bf3394516c9d55730", + "shasum": "" + }, + "require": { + "dhii/package-interface": "^0.1.0-alpha3", + "php": "^7.1 | ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^7.0 | ^8.0 | ^9.0", + "slevomat/coding-standard": "^6.0", + "symfony/polyfill-php80": "^1.19", + "vimeo/psalm": "^4.4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Dhii\\Versions\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Ukhanev", + "email": "xedin.unknown@gmail.com" + } + ], + "description": "Implementation for dealing with SemVer-compliant versions", + "time": "2021-12-08T16:54:50+00:00" + }, { "name": "psr/container", "version": "1.0.0", @@ -247,10 +424,6 @@ "container-interop", "psr" ], - "support": { - "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/master" - }, "time": "2017-02-14T16:28:37+00:00" }, { @@ -298,9 +471,6 @@ "psr", "psr-3" ], - "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" - }, "time": "2021-05-03T11:20:27+00:00" }, { @@ -341,10 +511,6 @@ } ], "description": "A polyfill for getallheaders.", - "support": { - "issues": "https://github.com/ralouphie/getallheaders/issues", - "source": "https://github.com/ralouphie/getallheaders/tree/develop" - }, "time": "2019-03-08T08:55:37+00:00" }, { @@ -395,6 +561,54 @@ ], "description": "Composer plugin to merge multiple composer.json files", "time": "2017-04-25T02:31:25+00:00" + }, + { + "name": "wp-oop/wordpress-interface", + "version": "v0.1.0-alpha2", + "source": { + "type": "git", + "url": "https://github.com/wp-oop/wordpress-interface.git", + "reference": "5e40acb49b76702f409bb5bcd2ea5459c9b946f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wp-oop/wordpress-interface/zipball/5e40acb49b76702f409bb5bcd2ea5459c9b946f5", + "reference": "5e40acb49b76702f409bb5bcd2ea5459c9b946f5", + "shasum": "" + }, + "require": { + "dhii/human-readable-interface": "^0.2.0-alpha1", + "dhii/package-interface": "^0.1-alpha3", + "php": "^7.1 | ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^7.0 | ^8.0 | ^9.0", + "slevomat/coding-standard": "^6.0", + "vimeo/psalm": "^4.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-task/initial-interfaces": "0.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "WpOop\\WordPress\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Ukhanev", + "email": "xedin.unknown@gmail.com" + } + ], + "description": "Interfaces for interop within WordPress", + "time": "2021-04-30T09:37:37+00:00" } ], "packages-dev": [ @@ -556,16 +770,16 @@ }, { "name": "antecedent/patchwork", - "version": "2.1.17", + "version": "2.1.21", "source": { "type": "git", "url": "https://github.com/antecedent/patchwork.git", - "reference": "df5aba175a44c2996ced4edf8ec9f9081b5348c0" + "reference": "25c1fa0cd9a6e6d0d13863d8df8f050b6733f16d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/antecedent/patchwork/zipball/df5aba175a44c2996ced4edf8ec9f9081b5348c0", - "reference": "df5aba175a44c2996ced4edf8ec9f9081b5348c0", + "url": "https://api.github.com/repos/antecedent/patchwork/zipball/25c1fa0cd9a6e6d0d13863d8df8f050b6733f16d", + "reference": "25c1fa0cd9a6e6d0d13863d8df8f050b6733f16d", "shasum": "" }, "require": { @@ -596,31 +810,31 @@ "runkit", "testing" ], - "time": "2021-10-21T14:22:43+00:00" + "time": "2022-02-07T07:28:34+00:00" }, { "name": "brain/monkey", - "version": "2.6.0", + "version": "2.6.1", "source": { "type": "git", "url": "https://github.com/Brain-WP/BrainMonkey.git", - "reference": "7042140000b4b18034c0c0010d86274a00f25442" + "reference": "a31c84515bb0d49be9310f52ef1733980ea8ffbb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Brain-WP/BrainMonkey/zipball/7042140000b4b18034c0c0010d86274a00f25442", - "reference": "7042140000b4b18034c0c0010d86274a00f25442", + "url": "https://api.github.com/repos/Brain-WP/BrainMonkey/zipball/a31c84515bb0d49be9310f52ef1733980ea8ffbb", + "reference": "a31c84515bb0d49be9310f52ef1733980ea8ffbb", "shasum": "" }, "require": { - "antecedent/patchwork": "^2.0", - "mockery/mockery": ">=0.9 <2", + "antecedent/patchwork": "^2.1.17", + "mockery/mockery": "^1.3.5 || ^1.4.4", "php": ">=5.6.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.6 || ^0.7", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1", "phpcompatibility/php-compatibility": "^9.3.0", - "phpunit/phpunit": "^5.7.9 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^5.7.26 || ^6.0 || ^7.0 || >=8.0 <8.5.12 || ^8.5.14 || ^9.0" }, "type": "library", "extra": { @@ -630,12 +844,12 @@ } }, "autoload": { - "psr-4": { - "Brain\\Monkey\\": "src/" - }, "files": [ "inc/api.php" - ] + ], + "psr-4": { + "Brain\\Monkey\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -662,20 +876,20 @@ "test", "testing" ], - "time": "2020-10-13T17:56:14+00:00" + "time": "2021-11-11T15:53:55+00:00" }, { "name": "composer/package-versions-deprecated", - "version": "1.11.99.4", + "version": "1.11.99.5", "source": { "type": "git", "url": "https://github.com/composer/package-versions-deprecated.git", - "reference": "b174585d1fe49ceed21928a945138948cb394600" + "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b174585d1fe49ceed21928a945138948cb394600", - "reference": "b174585d1fe49ceed21928a945138948cb394600", + "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b4f54f74ef3453349c24a845d22392cd31e65f1d", + "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d", "shasum": "" }, "require": { @@ -731,27 +945,94 @@ "type": "tidelift" } ], - "time": "2021-09-13T08:41:34+00:00" + "time": "2022-01-17T14:14:24+00:00" }, { - "name": "composer/semver", - "version": "3.2.6", + "name": "composer/pcre", + "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "83e511e247de329283478496f7a1e114c9517506" + "url": "https://github.com/composer/pcre.git", + "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/83e511e247de329283478496f7a1e114c9517506", - "reference": "83e511e247de329283478496f7a1e114c9517506", + "url": "https://api.github.com/repos/composer/pcre/zipball/67a32d7d6f9f560b726ab25a061b38ff3a80c560", + "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^0.12.54", + "phpstan/phpstan": "^1.3", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Pcre\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-01-21T20:24:37+00:00" + }, + { + "name": "composer/semver", + "version": "3.2.9", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "a951f614bd64dcd26137bc9b7b2637ddcfc57649" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/a951f614bd64dcd26137bc9b7b2637ddcfc57649", + "reference": "a951f614bd64dcd26137bc9b7b2637ddcfc57649", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.4", "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", @@ -807,29 +1088,31 @@ "type": "tidelift" } ], - "time": "2021-10-25T11:34:17+00:00" + "time": "2022-02-04T13:58:43+00:00" }, { "name": "composer/xdebug-handler", - "version": "2.0.2", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "84674dd3a7575ba617f5a76d7e9e29a7d3891339" + "reference": "0c1a3925ec58a4ec98e992b9c7d171e9e184be0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/84674dd3a7575ba617f5a76d7e9e29a7d3891339", - "reference": "84674dd3a7575ba617f5a76d7e9e29a7d3891339", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/0c1a3925ec58a4ec98e992b9c7d171e9e184be0a", + "reference": "0c1a3925ec58a4ec98e992b9c7d171e9e184be0a", "shasum": "" }, "require": { + "composer/pcre": "^1", "php": "^5.3.2 || ^7.0 || ^8.0", "psr/log": "^1 || ^2 || ^3" }, "require-dev": { - "phpstan/phpstan": "^0.12.55", - "symfony/phpunit-bridge": "^4.2 || ^5" + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^4.2 || ^5.0 || ^6.0" }, "type": "library", "autoload": { @@ -866,31 +1149,31 @@ "type": "tidelift" } ], - "time": "2021-07-31T17:03:58+00:00" + "time": "2022-01-04T17:06:45+00:00" }, { "name": "dealerdirect/phpcodesniffer-composer-installer", - "version": "v0.7.1", + "version": "v0.7.2", "source": { "type": "git", "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", - "reference": "fe390591e0241955f22eb9ba327d137e501c771c" + "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/fe390591e0241955f22eb9ba327d137e501c771c", - "reference": "fe390591e0241955f22eb9ba327d137e501c771c", + "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", + "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", "shasum": "" }, "require": { "composer-plugin-api": "^1.0 || ^2.0", "php": ">=5.3", - "squizlabs/php_codesniffer": "^2.0 || ^3.0 || ^4.0" + "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" }, "require-dev": { "composer/composer": "*", - "phpcompatibility/php-compatibility": "^9.0", - "sensiolabs/security-checker": "^4.1.0" + "php-parallel-lint/php-parallel-lint": "^1.3.1", + "phpcompatibility/php-compatibility": "^9.0" }, "type": "composer-plugin", "extra": { @@ -911,6 +1194,10 @@ "email": "franck.nijhof@dealerdirect.com", "homepage": "http://www.frenck.nl", "role": "Developer / IT Manager" + }, + { + "name": "Contributors", + "homepage": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer/graphs/contributors" } ], "description": "PHP_CodeSniffer Standards Composer Installer Plugin", @@ -922,6 +1209,7 @@ "codesniffer", "composer", "installer", + "phpcbf", "phpcs", "plugin", "qa", @@ -932,7 +1220,7 @@ "stylecheck", "tests" ], - "time": "2020-12-07T18:04:37+00:00" + "time": "2022-02-04T12:51:07+00:00" }, { "name": "dnoegel/php-xdg-base-dir", @@ -1016,20 +1304,6 @@ "constructor", "instantiate" ], - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], "time": "2020-11-10T18:47:58+00:00" }, { @@ -1283,12 +1557,6 @@ "object", "object graph" ], - "funding": [ - { - "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", - "type": "tidelift" - } - ], "time": "2020-11-13T09:40:50+00:00" }, { @@ -1339,16 +1607,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.13.0", + "version": "v4.13.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "50953a2691a922aa1769461637869a0a2faa3f53" + "reference": "210577fe3cf7badcc5814d99455df46564f3c077" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/50953a2691a922aa1769461637869a0a2faa3f53", - "reference": "50953a2691a922aa1769461637869a0a2faa3f53", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", + "reference": "210577fe3cf7badcc5814d99455df46564f3c077", "shasum": "" }, "require": { @@ -1387,7 +1655,7 @@ "parser", "php" ], - "time": "2021-09-20T12:20:58+00:00" + "time": "2021-11-30T19:35:32+00:00" }, { "name": "openlss/lib-array2xml", @@ -1542,16 +1810,16 @@ }, { "name": "php-stubs/woocommerce-stubs", - "version": "v5.8.0", + "version": "v5.9.0", "source": { "type": "git", "url": "https://github.com/php-stubs/woocommerce-stubs.git", - "reference": "e3978c519fb1e51585e8c86b489b802aa0c64cee" + "reference": "a7204cfbb5fa90720773122cb68530087de5bc78" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-stubs/woocommerce-stubs/zipball/e3978c519fb1e51585e8c86b489b802aa0c64cee", - "reference": "e3978c519fb1e51585e8c86b489b802aa0c64cee", + "url": "https://api.github.com/repos/php-stubs/woocommerce-stubs/zipball/a7204cfbb5fa90720773122cb68530087de5bc78", + "reference": "a7204cfbb5fa90720773122cb68530087de5bc78", "shasum": "" }, "require": { @@ -1578,28 +1846,31 @@ "woocommerce", "wordpress" ], - "time": "2021-10-15T14:13:09+00:00" + "time": "2021-11-05T10:02:27+00:00" }, { "name": "php-stubs/wordpress-stubs", - "version": "v5.8.1", + "version": "v5.9.0", "source": { "type": "git", "url": "https://github.com/php-stubs/wordpress-stubs.git", - "reference": "8b333464d3183bccde2fdbb814e3cae592434943" + "reference": "0fa8dd9a1bd2a1b60e85afc6c798fca1f599cc1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/8b333464d3183bccde2fdbb814e3cae592434943", - "reference": "8b333464d3183bccde2fdbb814e3cae592434943", + "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/0fa8dd9a1bd2a1b60e85afc6c798fca1f599cc1b", + "reference": "0fa8dd9a1bd2a1b60e85afc6c798fca1f599cc1b", "shasum": "" }, "replace": { "giacocorsiglia/wordpress-stubs": "*" }, "require-dev": { - "giacocorsiglia/stubs-generator": "^0.5.0", - "php": "~7.1" + "nikic/php-parser": "< 4.12.0", + "php": "~7.3 || ~8.0", + "php-stubs/generator": "^0.8.0", + "phpdocumentor/reflection-docblock": "^5.3", + "phpstan/phpstan": "^1.2" }, "suggest": { "paragonie/sodium_compat": "Pure PHP implementation of libsodium", @@ -1618,7 +1889,7 @@ "static analysis", "wordpress" ], - "time": "2021-09-09T22:10:19+00:00" + "time": "2022-01-26T00:27:45+00:00" }, { "name": "phpcompatibility/php-compatibility", @@ -1732,16 +2003,16 @@ }, { "name": "phpcompatibility/phpcompatibility-wp", - "version": "2.1.2", + "version": "2.1.3", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", - "reference": "a792ab623069f0ce971b2417edef8d9632e32f75" + "reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/a792ab623069f0ce971b2417edef8d9632e32f75", - "reference": "a792ab623069f0ce971b2417edef8d9632e32f75", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/d55de55f88697b9cdb94bccf04f14eb3b11cf308", + "reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308", "shasum": "" }, "require": { @@ -1778,7 +2049,7 @@ "standards", "wordpress" ], - "time": "2021-07-21T11:09:57+00:00" + "time": "2021-12-30T16:37:40+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -2056,16 +2327,16 @@ }, { "name": "phpunit/php-file-iterator", - "version": "2.0.4", + "version": "2.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "28af674ff175d0768a5a978e6de83f697d4a7f05" + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/28af674ff175d0768a5a978e6de83f697d4a7f05", - "reference": "28af674ff175d0768a5a978e6de83f697d4a7f05", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", "shasum": "" }, "require": { @@ -2108,7 +2379,7 @@ "type": "github" } ], - "time": "2021-07-19T06:46:01+00:00" + "time": "2021-12-02T12:42:26+00:00" }, { "name": "phpunit/php-text-template", @@ -2198,12 +2469,6 @@ "keywords": [ "timer" ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], "time": "2020-11-30T08:20:02+00:00" }, { @@ -2253,12 +2518,6 @@ "keywords": [ "tokenizer" ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], "abandoned": true, "time": "2021-07-26T12:15:06+00:00" }, @@ -2389,12 +2648,6 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], "time": "2020-11-30T08:15:22+00:00" }, { @@ -2459,12 +2712,6 @@ "compare", "equality" ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], "time": "2020-11-30T08:04:30+00:00" }, { @@ -2521,12 +2768,6 @@ "unidiff", "unified diff" ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], "time": "2020-11-30T07:59:04+00:00" }, { @@ -2580,26 +2821,20 @@ "environment", "hhvm" ], - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], "time": "2020-11-30T07:53:42+00:00" }, { "name": "sebastian/exporter", - "version": "3.1.3", + "version": "3.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "6b853149eab67d4da22291d36f5b0631c0fd856e" + "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/6b853149eab67d4da22291d36f5b0631c0fd856e", - "reference": "6b853149eab67d4da22291d36f5b0631c0fd856e", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", + "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", "shasum": "" }, "require": { @@ -2608,7 +2843,7 @@ }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { @@ -2659,7 +2894,7 @@ "type": "github" } ], - "time": "2020-11-30T07:47:53+00:00" + "time": "2021-11-11T13:51:24+00:00" }, { "name": "sebastian/global-state", @@ -2757,12 +2992,6 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], "time": "2020-11-30T07:40:27+00:00" }, { @@ -2808,12 +3037,6 @@ ], "description": "Allows reflection of object attributes, including inherited and non-public ones", "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], "time": "2020-11-30T07:37:18+00:00" }, { @@ -2867,12 +3090,6 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], "time": "2020-11-30T07:34:24+00:00" }, { @@ -2915,12 +3132,6 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], "time": "2020-11-30T07:30:19+00:00" }, { @@ -2968,16 +3179,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.6.1", + "version": "3.6.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "f268ca40d54617c6e06757f83f699775c9b3ff2e" + "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/f268ca40d54617c6e06757f83f699775c9b3ff2e", - "reference": "f268ca40d54617c6e06757f83f699775c9b3ff2e", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a", + "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a", "shasum": "" }, "require": { @@ -3015,20 +3226,20 @@ "phpcs", "standards" ], - "time": "2021-10-11T04:00:11+00:00" + "time": "2021-12-12T21:44:58+00:00" }, { "name": "symfony/console", - "version": "v4.4.30", + "version": "v4.4.37", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "a3f7189a0665ee33b50e9e228c46f50f5acbed22" + "reference": "0259f01dbf9d77badddbbf4c2abb681f24c9cac6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a3f7189a0665ee33b50e9e228c46f50f5acbed22", - "reference": "a3f7189a0665ee33b50e9e228c46f50f5acbed22", + "url": "https://api.github.com/repos/symfony/console/zipball/0259f01dbf9d77badddbbf4c2abb681f24c9cac6", + "reference": "0259f01dbf9d77badddbbf4c2abb681f24c9cac6", "shasum": "" }, "require": { @@ -3102,25 +3313,28 @@ "type": "tidelift" } ], - "time": "2021-08-25T19:27:26+00:00" + "time": "2022-01-26T16:15:26+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.23.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + "reference": "30885182c981ab175d4d034db0f6f469898070ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-ctype": "*" + }, "suggest": { "ext-ctype": "For best performance" }, @@ -3178,25 +3392,28 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-10-20T20:35:02+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.23.1", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6" + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-mbstring": "*" + }, "suggest": { "ext-mbstring": "For best performance" }, @@ -3211,12 +3428,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3255,20 +3472,20 @@ "type": "tidelift" } ], - "time": "2021-05-27T12:26:48+00:00" + "time": "2021-11-30T18:21:41+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.23.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5", "shasum": "" }, "require": { @@ -3285,12 +3502,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -3331,20 +3548,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-06-05T21:20:04+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.23.1", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be" + "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/57b712b08eddb97c762a8caa32c84e037892d2e9", + "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9", "shasum": "" }, "require": { @@ -3361,12 +3578,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -3411,20 +3628,20 @@ "type": "tidelift" } ], - "time": "2021-07-28T13:41:28+00:00" + "time": "2021-09-13T13:58:33+00:00" }, { "name": "symfony/service-contracts", - "version": "v1.1.9", + "version": "v1.1.11", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "b776d18b303a39f56c63747bcb977ad4b27aca26" + "reference": "633df678bec3452e04a7b0337c9bcfe7354124b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/b776d18b303a39f56c63747bcb977ad4b27aca26", - "reference": "b776d18b303a39f56c63747bcb977ad4b27aca26", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/633df678bec3452e04a7b0337c9bcfe7354124b3", + "reference": "633df678bec3452e04a7b0337c9bcfe7354124b3", "shasum": "" }, "require": { @@ -3437,7 +3654,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-main": "1.1-dev" }, "thanks": { "name": "symfony/contracts", @@ -3487,7 +3704,7 @@ "type": "tidelift" } ], - "time": "2020-07-06T13:19:58+00:00" + "time": "2021-11-04T13:32:43+00:00" }, { "name": "theseer/tokenizer", @@ -3531,16 +3748,16 @@ }, { "name": "vimeo/psalm", - "version": "4.11.2", + "version": "4.20.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "6fba5eb554f9507b72932f9c75533d8af593688d" + "reference": "f82a70e7edfc6cf2705e9374c8a0b6a974a779ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/6fba5eb554f9507b72932f9c75533d8af593688d", - "reference": "6fba5eb554f9507b72932f9c75533d8af593688d", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/f82a70e7edfc6cf2705e9374c8a0b6a974a779ed", + "reference": "f82a70e7edfc6cf2705e9374c8a0b6a974a779ed", "shasum": "" }, "require": { @@ -3548,7 +3765,7 @@ "amphp/byte-stream": "^1.5", "composer/package-versions-deprecated": "^1.8.0", "composer/semver": "^1.4 || ^2.0 || ^3.0", - "composer/xdebug-handler": "^1.1 || ^2.0", + "composer/xdebug-handler": "^1.1 || ^2.0 || ^3.0", "dnoegel/php-xdg-base-dir": "^0.1.1", "ext-ctype": "*", "ext-dom": "*", @@ -3564,7 +3781,7 @@ "openlss/lib-array2xml": "^1.0", "php": "^7.1|^8", "sebastian/diff": "^3.0 || ^4.0", - "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0", + "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0 || ^6.0", "webmozart/path-util": "^2.3" }, "provide": { @@ -3582,11 +3799,12 @@ "psalm/plugin-phpunit": "^0.16", "slevomat/coding-standard": "^7.0", "squizlabs/php_codesniffer": "^3.5", - "symfony/process": "^4.3 || ^5.0", + "symfony/process": "^4.3 || ^5.0 || ^6.0", "weirdan/prophecy-shim": "^1.0 || ^2.0" }, "suggest": { - "ext-igbinary": "^2.0.5" + "ext-curl": "In order to send data to shepherd", + "ext-igbinary": "^2.0.5 is required, used to serialize caching data" }, "bin": [ "psalm", @@ -3605,13 +3823,13 @@ } }, "autoload": { - "psr-4": { - "Psalm\\": "src/Psalm/" - }, "files": [ "src/functions.php", "src/spl_object_id.php" - ] + ], + "psr-4": { + "Psalm\\": "src/Psalm/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3628,7 +3846,7 @@ "inspection", "php" ], - "time": "2021-10-26T17:28:17+00:00" + "time": "2022-02-03T17:03:47+00:00" }, { "name": "webmozart/assert", @@ -3723,20 +3941,21 @@ } ], "description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.", + "abandoned": "symfony/filesystem", "time": "2015-12-17T08:42:14+00:00" }, { "name": "woocommerce/woocommerce-sniffs", - "version": "0.1.1", + "version": "0.1.2", "source": { "type": "git", "url": "https://github.com/woocommerce/woocommerce-sniffs.git", - "reference": "eb604d751b61c42f31ff1aa24113c7c0de438553" + "reference": "5566270d280a300bc24bd0cb055a8b9325afdd6b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/woocommerce/woocommerce-sniffs/zipball/eb604d751b61c42f31ff1aa24113c7c0de438553", - "reference": "eb604d751b61c42f31ff1aa24113c7c0de438553", + "url": "https://api.github.com/repos/woocommerce/woocommerce-sniffs/zipball/5566270d280a300bc24bd0cb055a8b9325afdd6b", + "reference": "5566270d280a300bc24bd0cb055a8b9325afdd6b", "shasum": "" }, "require": { @@ -3763,7 +3982,7 @@ "woocommerce", "wordpress" ], - "time": "2021-07-29T17:25:16+00:00" + "time": "2022-01-21T20:13:23+00:00" }, { "name": "wp-coding-standards/wpcs", diff --git a/modules/ppcp-admin-notices/src/Repository/Repository.php b/modules/ppcp-admin-notices/src/Repository/Repository.php index 066ed0ea8..e13a5dd6c 100644 --- a/modules/ppcp-admin-notices/src/Repository/Repository.php +++ b/modules/ppcp-admin-notices/src/Repository/Repository.php @@ -25,6 +25,9 @@ class Repository implements RepositoryInterface { */ public function current_message(): array { return array_filter( + /** + * Returns the list of admin messages. + */ (array) apply_filters( self::NOTICES_FILTER, array() diff --git a/modules/ppcp-api-client/services.php b/modules/ppcp-api-client/services.php index fa6d817f2..e4ce7ebb3 100644 --- a/modules/ppcp-api-client/services.php +++ b/modules/ppcp-api-client/services.php @@ -395,6 +395,9 @@ 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 { + /** + * Returns which countries and currency combinations can be used for DCC. + */ return apply_filters( 'woocommerce_paypal_payments_supported_country_currency_matrix', array( @@ -540,6 +543,9 @@ 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 { + /** + * Returns which countries support which credit cards. Empty credit card arrays mean no restriction on currency. + */ return apply_filters( 'woocommerce_paypal_payments_supported_country_card_matrix', array( diff --git a/modules/ppcp-api-client/src/Entity/PaymentToken.php b/modules/ppcp-api-client/src/Entity/PaymentToken.php index ca919dc2f..686813817 100644 --- a/modules/ppcp-api-client/src/Entity/PaymentToken.php +++ b/modules/ppcp-api-client/src/Entity/PaymentToken.php @@ -105,6 +105,9 @@ class PaymentToken { * @return array */ public static function get_valid_types() { + /** + * Returns a list of valid payment token types. + */ return apply_filters( 'woocommerce_paypal_payments_valid_payment_token_types', array( diff --git a/modules/ppcp-api-client/src/Factory/PayerFactory.php b/modules/ppcp-api-client/src/Factory/PayerFactory.php index 70d33dee3..6bec8fe80 100644 --- a/modules/ppcp-api-client/src/Factory/PayerFactory.php +++ b/modules/ppcp-api-client/src/Factory/PayerFactory.php @@ -55,10 +55,12 @@ class PayerFactory { $national_number = preg_replace( '/[^0-9]/', '', $national_number ); $national_number = substr( $national_number, 0, 14 ); - $phone = new PhoneWithType( - 'HOME', - new Phone( $national_number ) - ); + if ( $national_number ) { + $phone = new PhoneWithType( + 'HOME', + new Phone( $national_number ) + ); + } } return new Payer( new PayerName( @@ -91,10 +93,12 @@ class PayerFactory { $national_number = preg_replace( '/[^0-9]/', '', $national_number ); $national_number = substr( $national_number, 0, 14 ); - $phone = new PhoneWithType( - 'HOME', - new Phone( $national_number ) - ); + if ( $national_number ) { + $phone = new PhoneWithType( + 'HOME', + new Phone( $national_number ) + ); + } } return new Payer( new PayerName( @@ -176,10 +180,12 @@ class PayerFactory { if ( null !== $national_number ) { $national_number = substr( $national_number, 0, 14 ); - $phone = new PhoneWithType( - 'HOME', - new Phone( $national_number ) - ); + if ( $national_number ) { + $phone = new PhoneWithType( + 'HOME', + new Phone( $national_number ) + ); + } } } diff --git a/modules/ppcp-api-client/src/Factory/PurchaseUnitFactory.php b/modules/ppcp-api-client/src/Factory/PurchaseUnitFactory.php index c018d9917..37c371fb0 100644 --- a/modules/ppcp-api-client/src/Factory/PurchaseUnitFactory.php +++ b/modules/ppcp-api-client/src/Factory/PurchaseUnitFactory.php @@ -134,6 +134,9 @@ class PurchaseUnitFactory { $invoice_id, $soft_descriptor ); + /** + * Returns PurchaseUnit for the WC order. + */ return apply_filters( 'woocommerce_paypal_payments_purchase_unit_from_wc_order', $purchase_unit, diff --git a/modules/ppcp-api-client/src/Repository/ApplicationContextRepository.php b/modules/ppcp-api-client/src/Repository/ApplicationContextRepository.php index bfc28b25a..f6c87c804 100644 --- a/modules/ppcp-api-client/src/Repository/ApplicationContextRepository.php +++ b/modules/ppcp-api-client/src/Repository/ApplicationContextRepository.php @@ -74,7 +74,10 @@ class ApplicationContextRepository { $parts = explode( '-', $locale ); if ( count( $parts ) === 3 ) { - return substr( $locale, 0, strrpos( $locale, '-' ) ); + $ret = substr( $locale, 0, strrpos( $locale, '-' ) ); + if ( false !== $ret ) { + return $ret; + } } return 'en'; diff --git a/modules/ppcp-api-client/src/Repository/CustomerRepository.php b/modules/ppcp-api-client/src/Repository/CustomerRepository.php index 93134624e..99063b7e3 100644 --- a/modules/ppcp-api-client/src/Repository/CustomerRepository.php +++ b/modules/ppcp-api-client/src/Repository/CustomerRepository.php @@ -45,6 +45,8 @@ class CustomerRepository { } $unique_id = substr( $this->prefix . strrev( uniqid() ), 0, self::CLIENT_ID_MAX_LENGTH ); + assert( is_string( $unique_id ) ); + WC()->session->set( 'ppcp_guest_customer_id', $unique_id ); return $unique_id; diff --git a/modules/ppcp-api-client/src/Repository/PartnerReferralsData.php b/modules/ppcp-api-client/src/Repository/PartnerReferralsData.php index cdcdabac5..e2a13c949 100644 --- a/modules/ppcp-api-client/src/Repository/PartnerReferralsData.php +++ b/modules/ppcp-api-client/src/Repository/PartnerReferralsData.php @@ -75,10 +75,16 @@ class PartnerReferralsData { return array( 'partner_config_override' => array( 'partner_logo_url' => 'https://connect.woocommerce.com/images/woocommerce_logo.png', + /** + * Returns the URL which will be opened at the end of onboarding. + */ 'return_url' => apply_filters( 'woocommerce_paypal_payments_partner_config_override_return_url', admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=ppcp-gateway' ) ), + /** + * Returns the description of the URL which will be opened at the end of onboarding. + */ 'return_url_description' => apply_filters( 'woocommerce_paypal_payments_partner_config_override_return_url_description', __( 'Return to your shop.', 'woocommerce-paypal-payments' ) diff --git a/modules/ppcp-button/services.php b/modules/ppcp-button/services.php index f068cf5bb..9cec5b302 100644 --- a/modules/ppcp-button/services.php +++ b/modules/ppcp-button/services.php @@ -73,6 +73,7 @@ return array( $currency = $container->get( 'api.shop.currency' ); return new SmartButton( $container->get( 'button.url' ), + $container->get( 'ppcp.asset-version' ), $container->get( 'session.handler' ), $settings, $payer_factory, diff --git a/modules/ppcp-button/src/Assets/SmartButton.php b/modules/ppcp-button/src/Assets/SmartButton.php index 667560dbc..08e22815b 100644 --- a/modules/ppcp-button/src/Assets/SmartButton.php +++ b/modules/ppcp-button/src/Assets/SmartButton.php @@ -44,6 +44,13 @@ class SmartButton implements SmartButtonInterface { */ private $module_url; + /** + * The assets version. + * + * @var string + */ + private $version; + /** * The Session Handler. * @@ -125,6 +132,7 @@ class SmartButton implements SmartButtonInterface { * SmartButton constructor. * * @param string $module_url The URL to the module. + * @param string $version The assets version. * @param SessionHandler $session_handler The Session Handler. * @param Settings $settings The Settings. * @param PayerFactory $payer_factory The Payer factory. @@ -140,6 +148,7 @@ class SmartButton implements SmartButtonInterface { */ public function __construct( string $module_url, + string $version, SessionHandler $session_handler, Settings $settings, PayerFactory $payer_factory, @@ -155,6 +164,7 @@ class SmartButton implements SmartButtonInterface { ) { $this->module_url = $module_url; + $this->version = $version; $this->session_handler = $session_handler; $this->settings = $settings; $this->payer_factory = $payer_factory; @@ -406,7 +416,7 @@ class SmartButton implements SmartButtonInterface { 'ppcp-hosted-fields', untrailingslashit( $this->module_url ) . '/assets/css/hosted-fields.css', array(), - 1 + $this->version ); } if ( $load_script ) { @@ -414,7 +424,7 @@ class SmartButton implements SmartButtonInterface { 'ppcp-smart-button', untrailingslashit( $this->module_url ) . '/assets/js/button.js', array( 'jquery' ), - '1.3.2', + $this->version, true ); @@ -1012,38 +1022,50 @@ class SmartButton implements SmartButtonInterface { } /** - * Return action name PayPal buttons will be rendered at on checkout page. + * Returns the action name that PayPal button will use for rendering on the checkout page. * * @return string Action name. */ private function checkout_button_renderer_hook(): string { + /** + * The filter returning the action name that PayPal button will use for rendering on the checkout page. + */ return (string) apply_filters( 'woocommerce_paypal_payments_checkout_button_renderer_hook', 'woocommerce_review_order_after_payment' ); } /** - * Return action name PayPal DCC button will be rendered at on checkout page. + * Returns the action name that PayPal DCC button will use for rendering on the checkout page. * * @return string */ private function checkout_dcc_button_renderer_hook(): string { + /** + * The filter returning the action name that PayPal DCC button will use for rendering on the checkout page. + */ return (string) apply_filters( 'woocommerce_paypal_payments_checkout_dcc_renderer_hook', 'woocommerce_review_order_after_submit' ); } /** - * Return action name PayPal button and Pay Later message will be rendered at on pay-order page. + * Returns the action name that PayPal button and Pay Later message will use for rendering on the pay-order page. * * @return string */ private function pay_order_renderer_hook(): string { + /** + * The filter returning the action name that PayPal button and Pay Later message will use for rendering on the pay-order page. + */ return (string) apply_filters( 'woocommerce_paypal_payments_pay_order_dcc_renderer_hook', 'woocommerce_pay_order_after_submit' ); } /** - * Return action name PayPal button will be rendered next to Proceed to checkout button (normally displayed in cart). + * Returns action name that PayPal button will use for rendering next to Proceed to checkout button (normally displayed in cart). * * @return string */ private function proceed_to_checkout_button_renderer_hook(): string { + /** + * The filter returning the action name that PayPal button will use for rendering next to Proceed to checkout button (normally displayed in cart). + */ return (string) apply_filters( 'woocommerce_paypal_payments_proceed_to_checkout_button_renderer_hook', 'woocommerce_proceed_to_checkout' @@ -1051,11 +1073,14 @@ class SmartButton implements SmartButtonInterface { } /** - * Return action name PayPal button will be rendered in the WC mini cart. + * Returns the action name that PayPal button will use for rendering in the WC mini cart. * * @return string */ private function mini_cart_button_renderer_hook(): string { + /** + * The filter returning the action name that PayPal button will use for rendering in the WC mini cart. + */ return (string) apply_filters( 'woocommerce_paypal_payments_mini_cart_button_renderer_hook', 'woocommerce_widget_shopping_cart_after_buttons' @@ -1063,11 +1088,14 @@ class SmartButton implements SmartButtonInterface { } /** - * Return action name PayPal button and Pay Later message will be rendered at on the single product page. + * Returns the action name that PayPal button and Pay Later message will use for rendering on the single product page. * * @return string */ private function single_product_renderer_hook(): string { + /** + * The filter returning the action name that PayPal button and Pay Later message will use for rendering on the single product page. + */ return (string) apply_filters( 'woocommerce_paypal_payments_single_product_renderer_hook', 'woocommerce_single_product_summary' ); } } diff --git a/modules/ppcp-compat/src/PPEC/PPECHelper.php b/modules/ppcp-compat/src/PPEC/PPECHelper.php index 09fca3c19..71e16e544 100644 --- a/modules/ppcp-compat/src/PPEC/PPECHelper.php +++ b/modules/ppcp-compat/src/PPEC/PPECHelper.php @@ -89,6 +89,9 @@ class PPECHelper { * @return bool */ public static function use_ppec_compat_layer_for_subscriptions() { + /** + * The filter returning whether the compatibility layer for PPEC Subscriptions should be initialized. + */ return ( ! self::is_gateway_available() ) && self::site_has_ppec_subscriptions() && apply_filters( 'woocommerce_paypal_payments_process_legacy_subscriptions', true ); } diff --git a/modules/ppcp-onboarding/services.php b/modules/ppcp-onboarding/services.php index fa3615851..a3a2fec58 100644 --- a/modules/ppcp-onboarding/services.php +++ b/modules/ppcp-onboarding/services.php @@ -131,9 +131,11 @@ return array( $login_seller_endpoint = $container->get( 'onboarding.endpoint.login-seller' ); return new OnboardingAssets( $container->get( 'onboarding.url' ), + $container->get( 'ppcp.asset-version' ), $state, $container->get( 'onboarding.environment' ), - $login_seller_endpoint + $login_seller_endpoint, + $container->get( 'wcgateway.current-ppcp-settings-page-id' ) ); }, diff --git a/modules/ppcp-onboarding/src/Assets/OnboardingAssets.php b/modules/ppcp-onboarding/src/Assets/OnboardingAssets.php index 8e4971cf0..55e99c0d1 100644 --- a/modules/ppcp-onboarding/src/Assets/OnboardingAssets.php +++ b/modules/ppcp-onboarding/src/Assets/OnboardingAssets.php @@ -12,6 +12,7 @@ namespace WooCommerce\PayPalCommerce\Onboarding\Assets; use WooCommerce\PayPalCommerce\Onboarding\Endpoint\LoginSellerEndpoint; use WooCommerce\PayPalCommerce\Onboarding\Environment; use WooCommerce\PayPalCommerce\Onboarding\State; +use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway; /** * Class OnboardingAssets @@ -25,6 +26,13 @@ class OnboardingAssets { */ private $module_url; + /** + * The assets version. + * + * @var string + */ + private $version; + /** * The State. * @@ -46,25 +54,38 @@ class OnboardingAssets { */ private $login_seller_endpoint; + /** + * ID of the current PPCP gateway settings page, or empty if it is not such page. + * + * @var string + */ + protected $page_id; + /** * OnboardingAssets constructor. * * @param string $module_url The URL to the module. + * @param string $version The assets version. * @param State $state The State object. * @param Environment $environment The Environment. * @param LoginSellerEndpoint $login_seller_endpoint The LoginSeller endpoint. + * @param string $page_id ID of the current PPCP gateway settings page, or empty if it is not such page. */ public function __construct( string $module_url, + string $version, State $state, Environment $environment, - LoginSellerEndpoint $login_seller_endpoint + LoginSellerEndpoint $login_seller_endpoint, + string $page_id ) { $this->module_url = untrailingslashit( $module_url ); + $this->version = $version; $this->state = $state; $this->environment = $environment; $this->login_seller_endpoint = $login_seller_endpoint; + $this->page_id = $page_id; } /** @@ -79,14 +100,14 @@ class OnboardingAssets { 'ppcp-onboarding', $url, array(), - 1 + $this->version ); $url = untrailingslashit( $this->module_url ) . '/assets/js/settings.js'; wp_register_script( 'ppcp-settings', $url, array(), - 1, + $this->version, true ); @@ -95,7 +116,7 @@ class OnboardingAssets { 'ppcp-onboarding', $url, array( 'jquery' ), - 1, + $this->version, true ); wp_localize_script( @@ -149,7 +170,6 @@ class OnboardingAssets { * @return bool */ private function should_render_onboarding_script(): bool { - global $current_section; - return 'ppcp-gateway' === $current_section; + return PayPalGateway::ID === $this->page_id; } } diff --git a/modules/ppcp-subscription/src/RenewalHandler.php b/modules/ppcp-subscription/src/RenewalHandler.php index e2815baf6..2103e443d 100644 --- a/modules/ppcp-subscription/src/RenewalHandler.php +++ b/modules/ppcp-subscription/src/RenewalHandler.php @@ -174,6 +174,9 @@ class RenewalHandler { * @return PaymentToken|null */ private function get_token_for_customer( \WC_Customer $customer, \WC_Order $wc_order ) { + /** + * Returns a payment token for a customer, or null. + */ $token = apply_filters( 'woocommerce_paypal_payments_subscriptions_get_token_for_customer', null, $customer, $wc_order ); if ( null !== $token ) { return $token; diff --git a/modules/ppcp-vaulting/services.php b/modules/ppcp-vaulting/services.php index 0e3e2d7d1..c7b5bac1e 100644 --- a/modules/ppcp-vaulting/services.php +++ b/modules/ppcp-vaulting/services.php @@ -22,7 +22,8 @@ return array( }, 'vaulting.assets.myaccount-payments' => function( ContainerInterface $container ) : MyAccountPaymentsAssets { return new MyAccountPaymentsAssets( - $container->get( 'vaulting.module-url' ) + $container->get( 'vaulting.module-url' ), + $container->get( 'ppcp.asset-version' ) ); }, 'vaulting.payment-tokens-renderer' => static function (): PaymentTokensRenderer { diff --git a/modules/ppcp-vaulting/src/Assets/MyAccountPaymentsAssets.php b/modules/ppcp-vaulting/src/Assets/MyAccountPaymentsAssets.php index 80e9bc3db..36c3a4da3 100644 --- a/modules/ppcp-vaulting/src/Assets/MyAccountPaymentsAssets.php +++ b/modules/ppcp-vaulting/src/Assets/MyAccountPaymentsAssets.php @@ -23,15 +23,25 @@ class MyAccountPaymentsAssets { */ private $module_url; + /** + * The assets version. + * + * @var string + */ + private $version; + /** * MyAccountPaymentsAssets constructor. * * @param string $module_url The URL to the module. + * @param string $version The assets version. */ public function __construct( - string $module_url + string $module_url, + string $version ) { $this->module_url = untrailingslashit( $module_url ); + $this->version = $version; } /** @@ -44,7 +54,7 @@ class MyAccountPaymentsAssets { 'ppcp-vaulting-myaccount-payments', untrailingslashit( $this->module_url ) . '/assets/js/myaccount-payments.js', array( 'jquery' ), - '1', + $this->version, true ); } diff --git a/modules/ppcp-wc-gateway/services.php b/modules/ppcp-wc-gateway/services.php index 90889fab5..cfcbb18c1 100644 --- a/modules/ppcp-wc-gateway/services.php +++ b/modules/ppcp-wc-gateway/services.php @@ -905,6 +905,9 @@ return array( 'type' => 'select', 'class' => array(), 'input_class' => array( 'wc-enhanced-select' ), + /** + * Returns default label ID of the PayPal button. + */ 'default' => apply_filters( 'woocommerce_paypal_payments_button_label_default', 'paypal' ), 'desc_tip' => true, 'description' => __( @@ -1207,6 +1210,9 @@ return array( 'type' => 'select', 'class' => array(), 'input_class' => array( 'wc-enhanced-select' ), + /** + * Returns default label ID of the PayPal button on product pages. + */ 'default' => apply_filters( 'woocommerce_paypal_payments_button_product_label_default', 'paypal' ), 'desc_tip' => true, 'description' => __( @@ -1510,6 +1516,9 @@ return array( 'type' => 'select', 'class' => array(), 'input_class' => array( 'wc-enhanced-select' ), + /** + * Returns default label ID of the PayPal button in cart. + */ 'default' => apply_filters( 'woocommerce_paypal_payments_button_cart_label_default', 'paypal' ), 'desc_tip' => true, 'description' => __( @@ -1813,6 +1822,9 @@ return array( 'type' => 'select', 'class' => array(), 'input_class' => array( 'wc-enhanced-select' ), + /** + * Returns default label ID of the PayPal button in mini cart. + */ 'default' => apply_filters( 'woocommerce_paypal_payments_button_mini_cart_label_default', 'paypal' ), 'desc_tip' => true, 'description' => __( diff --git a/modules/ppcp-wc-gateway/src/Assets/SettingsPageAssets.php b/modules/ppcp-wc-gateway/src/Assets/SettingsPageAssets.php index fd89636ad..d2c031622 100644 --- a/modules/ppcp-wc-gateway/src/Assets/SettingsPageAssets.php +++ b/modules/ppcp-wc-gateway/src/Assets/SettingsPageAssets.php @@ -25,11 +25,11 @@ class SettingsPageAssets { private $module_url; /** - * The filesystem path to the module dir. + * The assets version. * * @var string */ - private $module_path; + private $version; /** * The bearer. @@ -42,13 +42,13 @@ class SettingsPageAssets { * Assets constructor. * * @param string $module_url The url of this module. - * @param string $module_path The filesystem path to this module. + * @param string $version The assets version. * @param Bearer $bearer The bearer. */ - public function __construct( string $module_url, string $module_path, Bearer $bearer ) { - $this->module_url = $module_url; - $this->module_path = $module_path; - $this->bearer = $bearer; + public function __construct( string $module_url, string $version, Bearer $bearer ) { + $this->module_url = $module_url; + $this->version = $version; + $this->bearer = $bearer; } /** @@ -102,13 +102,11 @@ class SettingsPageAssets { * @param Bearer $bearer The bearer. */ private function register_admin_assets( Bearer $bearer ) { - $gateway_settings_script_path = trailingslashit( $this->module_path ) . 'assets/js/gateway-settings.js'; - wp_enqueue_script( 'ppcp-gateway-settings', trailingslashit( $this->module_url ) . 'assets/js/gateway-settings.js', array(), - file_exists( $gateway_settings_script_path ) ? (string) filemtime( $gateway_settings_script_path ) : null, + $this->version, true ); diff --git a/modules/ppcp-wc-gateway/src/Settings/SettingsListener.php b/modules/ppcp-wc-gateway/src/Settings/SettingsListener.php index ba2f4b08c..6ddf945d4 100644 --- a/modules/ppcp-wc-gateway/src/Settings/SettingsListener.php +++ b/modules/ppcp-wc-gateway/src/Settings/SettingsListener.php @@ -146,8 +146,14 @@ class SettingsListener { } $this->settings->persist(); + /** + * The hook fired before performing the redirect at the end of onboarding after saving the merchant ID/email. + */ do_action( 'woocommerce_paypal_payments_onboarding_before_redirect' ); + /** + * The URL opened at the end of onboarding after saving the merchant ID/email. + */ $redirect_url = apply_filters( 'woocommerce_paypal_payments_onboarding_redirect_url', admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=ppcp-gateway' ) ); if ( ! $this->settings->has( 'client_id' ) || ! $this->settings->get( 'client_id' ) ) { $redirect_url = add_query_arg( 'ppcp-onboarding-error', '1', $redirect_url ); diff --git a/modules/ppcp-wc-gateway/src/WCGatewayModule.php b/modules/ppcp-wc-gateway/src/WCGatewayModule.php index ee8746ca5..2649e60af 100644 --- a/modules/ppcp-wc-gateway/src/WCGatewayModule.php +++ b/modules/ppcp-wc-gateway/src/WCGatewayModule.php @@ -74,7 +74,7 @@ class WCGatewayModule implements ModuleInterface { if ( $c->has( 'wcgateway.url' ) ) { $assets = new SettingsPageAssets( $c->get( 'wcgateway.url' ), - $c->get( 'wcgateway.absolute-path' ), + $c->get( 'ppcp.asset-version' ), $c->get( 'api.bearer' ) ); $assets->register_assets(); diff --git a/modules/ppcp-webhooks/services.php b/modules/ppcp-webhooks/services.php index 536abaa1b..1b5269ab3 100644 --- a/modules/ppcp-webhooks/services.php +++ b/modules/ppcp-webhooks/services.php @@ -156,7 +156,8 @@ return array( 'webhook.status.assets' => function( ContainerInterface $container ) : WebhooksStatusPageAssets { return new WebhooksStatusPageAssets( - $container->get( 'webhook.module-url' ) + $container->get( 'webhook.module-url' ), + $container->get( 'ppcp.asset-version' ) ); }, diff --git a/modules/ppcp-webhooks/src/Status/Assets/WebhooksStatusPageAssets.php b/modules/ppcp-webhooks/src/Status/Assets/WebhooksStatusPageAssets.php index 27f0c0dd1..9ad6f8e70 100644 --- a/modules/ppcp-webhooks/src/Status/Assets/WebhooksStatusPageAssets.php +++ b/modules/ppcp-webhooks/src/Status/Assets/WebhooksStatusPageAssets.php @@ -26,15 +26,25 @@ class WebhooksStatusPageAssets { */ private $module_url; + /** + * The assets version. + * + * @var string + */ + private $version; + /** * WebhooksStatusPageAssets constructor. * * @param string $module_url The URL to the module. + * @param string $version The assets version. */ public function __construct( - string $module_url + string $module_url, + string $version ) { $this->module_url = untrailingslashit( $module_url ); + $this->version = $version; } /** @@ -47,14 +57,14 @@ class WebhooksStatusPageAssets { 'ppcp-webhooks-status-page-style', untrailingslashit( $this->module_url ) . '/assets/css/status-page.css', array(), - '1' + $this->version ); wp_register_script( 'ppcp-webhooks-status-page', untrailingslashit( $this->module_url ) . '/assets/js/status-page.js', array(), - '1', + $this->version, true ); diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 0ad53d8d5..74844b9bd 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + PAYPAL_API_URL @@ -12,9 +12,6 @@ - - $customer_id - $response @@ -52,9 +49,6 @@ - - $id - $response @@ -212,9 +206,7 @@ (float) $item_total - - (float) $cart->get_cart_contents_tax() - (float) $cart->get_discount_tax() + (float) $cart->get_discount_total() (float) $cart->get_shipping_total() (float) $cart->get_total( 'numeric' ) @@ -288,6 +280,9 @@ + + realpath( __FILE__ ) + CONNECT_WOO_CLIENT_ID CONNECT_WOO_SANDBOX_CLIENT_ID @@ -297,13 +292,9 @@ 1 - - $default_fields + $id - - function ( $default_fields, $id ) { - button_renderer dcc_renderer @@ -440,6 +431,9 @@ $container + + realpath( __FILE__ ) + CONNECT_WOO_MERCHANT_ID CONNECT_WOO_SANDBOX_MERCHANT_ID @@ -532,18 +526,13 @@ current( $tokens ) - - capture_order + process_order renew - - (int) $customer->get_id() + (int) $customer->get_id() (int) $wc_order->get_customer_id() - (int) $wc_order->get_id() - (int) $wc_order->get_id() - (int) $wc_order->get_id() apply_filters( 'woocommerce_paypal_payments_subscriptions_get_token_for_customer', null, $customer, $wc_order ) @@ -571,6 +560,11 @@ \WC_Subscription + + + realpath( __FILE__ ) + + localize @@ -603,6 +597,13 @@ + + realpath( __FILE__ ) + realpath( __FILE__ ) + + + substr( $letters, 0, 6 ) + wp_unslash( $_GET[ SectionsRenderer::KEY ] ) wp_unslash( $_GET['page'] ) @@ -637,7 +638,6 @@ - phone phone phone purchase_units @@ -764,7 +764,7 @@ - + $args $args $column @@ -774,9 +774,7 @@ $methods $methods $notices - $order $order_actions - $recipient $value $wc_order_id $wc_order_id @@ -793,6 +791,11 @@ $container + + + realpath( __FILE__ ) + + handle_request @@ -918,4 +921,9 @@ + + + realpath( __FILE__ ) + + diff --git a/psalm.xml.dist b/psalm.xml.dist index 003d84c3c..90477c793 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -9,7 +9,6 @@ usePhpDocMethodsWithoutMagicCall="false" strictBinaryOperands="true" rememberPropertyAssignmentsAfterCall="true" - allowPhpStormGenerics="true" allowStringToStandInForClass="false" memoizeMethodCallResults="false" hoistConstants="false" diff --git a/readme.txt b/readme.txt index ef3064bb4..c3d1d8552 100644 --- a/readme.txt +++ b/readme.txt @@ -93,6 +93,7 @@ Follow the steps below to connect the plugin to your PayPal account: * Enhancement - Pass address details to credit card fields #479 * Enhancement - Improve onboarding notice #465 * Enhancement - Add transaction ID to WC order and order note when refund is received #473 +* Enhancement - Asset caching may cause bugs on upgrades #501 = 1.6.5 = * Fix - Allow guest users to purchase subscription products from checkout page #422 diff --git a/src/FilePathPluginFactory.php b/src/FilePathPluginFactory.php new file mode 100644 index 000000000..c1527e0a2 --- /dev/null +++ b/src/FilePathPluginFactory.php @@ -0,0 +1,134 @@ +version_factory = $version_factory; + } + + /** + * Extracts plugin info from plugin file path. + * + * @param string $filePath The plugin file path. + */ + public function createPluginFromFilePath( string $filePath ): PluginInterface { + if ( ! is_readable( $filePath ) ) { + throw new RuntimeException( + sprintf( + 'Plugin file "%1$s" does not exist or is not readable', + $filePath + ) + ); + } + + $plugin_data = get_plugin_data( $filePath ); + if ( empty( $plugin_data ) ) { + throw new UnexpectedValueException( + sprintf( + 'Plugin file "%1$s" does not have a valid plugin header', + $filePath + ) + ); + } + + $plugin_data = array_merge( + array( + 'Name' => '', + 'Version' => '0.1.0-alpha1+default', + 'Title' => '', + 'Description' => '', + 'TextDomain' => '', + 'RequiresWP' => '5.0', + 'RequiresPHP' => '7.1', + ), + $plugin_data + ); + + $base_dir = dirname( $filePath ); + $base_name = plugin_basename( $filePath ); + $slug = $this->get_plugin_slug( $base_name ); + $text_domain = ! empty( $plugin_data['TextDomain'] ) ? $plugin_data['TextDomain'] : $slug; + + return new Plugin( + $plugin_data['Name'], + $this->create_version( $plugin_data['Version'] ), + $base_dir, + $base_name, + $plugin_data['Title'], + $plugin_data['Description'], + $text_domain, + $this->create_version( $plugin_data['RequiresPHP'] ), + $this->create_version( $plugin_data['RequiresWP'] ) + ); + } + + /** + * Creates a new version from a version string. + * + * @param string $version_string The SemVer-compliant version string. + * + * @return VersionInterface The new version. + * + * @throws Exception If version string is malformed. + */ + protected function create_version( string $version_string ): VersionInterface { + return $this->version_factory->createVersionFromString( $version_string ); + } + + /** + * Retrieves a plugin slug from its basename. + * + * @param string $base_name The plugin's basename. + * + * @return string The plugin's slug. + */ + protected function get_plugin_slug( string $base_name ): string { + $directory_separator = '/'; + + // If plugin is in a directory, use directory name. + if ( strstr( $base_name, $directory_separator ) !== false ) { + $parts = explode( $directory_separator, $base_name ); + if ( $parts ) { + return $parts[0]; + } + } + + // If plugin is not in a directory, return plugin file basename. + return basename( $base_name ); + } +} diff --git a/src/Plugin.php b/src/Plugin.php new file mode 100644 index 000000000..b889cffad --- /dev/null +++ b/src/Plugin.php @@ -0,0 +1,180 @@ +name = $name; + $this->description = $description; + $this->version = $version; + $this->base_dir = $base_dir; + $this->base_name = $base_name; + $this->title = $title; + $this->text_domain = $text_domain; + $this->min_php_version = $min_php_version; + $this->min_wp_version = $min_wp_version; + } + + /** + * The plugin name. + */ + public function getName(): string { + return $this->name; + } + + /** + * The plugin description. + */ + public function getDescription(): string { + return $this->description; + } + + /** + * The plugin version. + */ + public function getVersion(): VersionInterface { + return $this->version; + } + + /** + * The path to the plugin base directory. + */ + public function getBaseDir(): string { + return $this->base_dir; + } + + /** + * The plugin base name. + */ + public function getBaseName(): string { + return $this->base_name; + } + + /** + * The text domain of this plugin. + */ + public function getTextDomain(): string { + return $this->text_domain; + } + + /** + * The plugin title. + */ + public function getTitle(): string { + return $this->title; + } + + /** + * The minimal version of PHP required by this plugin. + */ + public function getMinPhpVersion(): VersionInterface { + return $this->min_php_version; + } + + /** + * The minimal version of WP required by this plugin. + */ + public function getMinWpVersion(): VersionInterface { + return $this->min_wp_version; + } +} diff --git a/src/PluginModule.php b/src/PluginModule.php index 7f405db42..8ed310f4a 100644 --- a/src/PluginModule.php +++ b/src/PluginModule.php @@ -23,7 +23,10 @@ class PluginModule implements ModuleInterface { * {@inheritDoc} */ public function setup(): ServiceProviderInterface { - return new ServiceProvider( array(), array() ); + return new ServiceProvider( + require __DIR__ . '/services.php', + require __DIR__ . '/extensions.php' + ); } /** diff --git a/src/extensions.php b/src/extensions.php new file mode 100644 index 000000000..63d0bdc0f --- /dev/null +++ b/src/extensions.php @@ -0,0 +1,12 @@ + function( ContainerInterface $container ) : PluginInterface { + $factory = new FilePathPluginFactory( new StringVersionFactory() ); + return $factory->createPluginFromFilePath( dirname( realpath( __FILE__ ), 2 ) . '/woocommerce-paypal-payments.php' ); + }, + 'ppcp.asset-version' => function( ContainerInterface $container ) : string { + $plugin = $container->get( 'ppcp.plugin' ); + assert( $plugin instanceof PluginInterface ); + + return (string) $plugin->getVersion(); + }, +); diff --git a/tests/PHPUnit/TestCase.php b/tests/PHPUnit/TestCase.php index 8d7d821bd..eee31ab98 100644 --- a/tests/PHPUnit/TestCase.php +++ b/tests/PHPUnit/TestCase.php @@ -25,6 +25,8 @@ class TestCase extends \PHPUnit\Framework\TestCase when('sanitize_text_field')->returnArg(); when('wp_kses_post')->returnArg(); when('wp_unslash')->returnArg(); + when('get_plugin_data')->justReturn(['Version' => '1.0']); + when('plugin_basename')->justReturn('woocommerce-paypal-payments/woocommerce-paypal-payments.php'); setUp(); } diff --git a/woocommerce-paypal-payments.php b/woocommerce-paypal-payments.php index 81531358a..8bb582382 100644 --- a/woocommerce-paypal-payments.php +++ b/woocommerce-paypal-payments.php @@ -73,6 +73,9 @@ define( 'PPCP_FLAG_SUBSCRIPTION', true ); $app_container = $bootstrap( $root_dir ); $initialized = true; + /** + * The hook fired after the plugin bootstrap with the app services container as parameter. + */ do_action( 'woocommerce_paypal_payments_built_container', $app_container ); } } @@ -88,6 +91,9 @@ define( 'PPCP_FLAG_SUBSCRIPTION', true ); $plugin_data = get_plugin_data( __DIR__ . '/woocommerce-paypal-payments.php' ); $plugin_version = $plugin_data['Version'] ?? null; if ( get_option( 'woocommerce-ppcp-version' ) !== $plugin_version ) { + /** + * The hook fired when the plugin is installed or updated. + */ do_action( 'woocommerce_paypal_payments_gateway_migrate' ); update_option( 'woocommerce-ppcp-version', $plugin_version ); } @@ -97,6 +103,9 @@ define( 'PPCP_FLAG_SUBSCRIPTION', true ); __FILE__, function () { init(); + /** + * The hook fired in register_activation_hook. + */ do_action( 'woocommerce_paypal_payments_gateway_activate' ); } ); @@ -104,6 +113,9 @@ define( 'PPCP_FLAG_SUBSCRIPTION', true ); __FILE__, function () { init(); + /** + * The hook fired in register_deactivation_hook. + */ do_action( 'woocommerce_paypal_payments_gateway_deactivate' ); } );