From 0c4315082f432eac191656196585a1916b0c48a4 Mon Sep 17 00:00:00 2001 From: Sibin Grasic Date: Fri, 31 Jan 2025 21:37:43 +0100 Subject: [PATCH] feat: Migrated to XWP-DI BREAKING CHANGES: Breaks everything --- composer.json | 31 +- composer.lock | 776 +++++++++++++++++++------------- src/Builder.php | 112 +++++ src/Compat/Extremis_Legacy.php | 18 - src/Decorators/Theme_Module.php | 71 +++ src/Extremis.php | 139 ------ src/Theme.php | 103 +++++ src/Utils/extremis-helpers.php | 27 +- 8 files changed, 794 insertions(+), 483 deletions(-) create mode 100644 src/Builder.php delete mode 100644 src/Compat/Extremis_Legacy.php create mode 100644 src/Decorators/Theme_Module.php delete mode 100644 src/Extremis.php create mode 100644 src/Theme.php diff --git a/composer.json b/composer.json index 9852484..8781118 100644 --- a/composer.json +++ b/composer.json @@ -4,32 +4,26 @@ "license": "GPL-2.0-or-later", "require": { "php": ">=8.0", - "automattic/jetpack-constants": "^2.0", - "oblak/wp-asset-loader": "3 - 5", - "oblak/wp-hook-di": "1 - 2", - "x-wp/helper-traits": "^1" + "x-wp/asset-loader": "^1.1.2", + "x-wp/di": "^1.5.3" }, "require-dev": { - "oblak/wordpress-coding-standard": "^1", - "php-stubs/wordpress-stubs": "^6.5", - "phpstan/extension-installer": "^1.3", - "phpstan/phpstan": "^1.10", - "phpstan/phpstan-deprecation-rules": "^1.1", - "swissspidy/phpstan-no-private": "^0.2.0", - "symfony/var-dumper": "^6.4", - "szepeviktor/phpstan-wordpress": "^1.3" + "oblak/wordpress-coding-standard": "^1.2.6", + "php-stubs/wordpress-stubs": "^6.7.1", + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan": "^1.12.16", + "phpstan/phpstan-deprecation-rules": "^1.2.1", + "swissspidy/phpstan-no-private": "^0.2.1", + "symfony/var-dumper": "^6.4.18", + "szepeviktor/phpstan-wordpress": "^1.3.5" }, "suggest": { - "automattic/jetpack-autoloader": "Allow for better interoperability with other plugins that use extremis dependencies.", - "oblak/composer-wp-di-finder-plugin": "Automatically find Hookable classes" + "automattic/jetpack-autoloader": "Allow for better interoperability with other plugins that use extremis dependencies." }, "autoload": { "psr-4": { - "Oblak\\WP\\": "src/" + "XWP\\Extremis\\": "src/" }, - "classmap": [ - "src/Compat/" - ], "files": [ "src/Utils/extremis-helpers.php" ] @@ -38,7 +32,6 @@ "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true, "ergebnis/composer-normalize": true, - "oblak/composer-wp-di-finder-plugin": true, "phpstan/extension-installer": true } } diff --git a/composer.lock b/composer.lock index 78f13d5..f75241a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,27 +4,27 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b111a932dffc9457e1f96ff210677882", + "content-hash": "6acecffbb869101c0e51eb9652f0df74", "packages": [ { "name": "automattic/jetpack-constants", - "version": "v2.0.4", + "version": "v2.0.5", "source": { "type": "git", "url": "https://github.com/Automattic/jetpack-constants.git", - "reference": "f6958c313a34c5e92171c45a57d9dc978e5975ed" + "reference": "0c2644d642b06ae2a31c561f5bfc6f74a4abc8f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/jetpack-constants/zipball/f6958c313a34c5e92171c45a57d9dc978e5975ed", - "reference": "f6958c313a34c5e92171c45a57d9dc978e5975ed", + "url": "https://api.github.com/repos/Automattic/jetpack-constants/zipball/0c2644d642b06ae2a31c561f5bfc6f74a4abc8f1", + "reference": "0c2644d642b06ae2a31c561f5bfc6f74a4abc8f1", "shasum": "" }, "require": { "php": ">=7.0" }, "require-dev": { - "automattic/jetpack-changelogger": "^4.2.6", + "automattic/jetpack-changelogger": "^4.2.8", "brain/monkey": "2.6.1", "yoast/phpunit-polyfills": "^1.1.1" }, @@ -35,11 +35,11 @@ "extra": { "autotagger": true, "mirror-repo": "Automattic/jetpack-constants", - "changelogger": { - "link-template": "https://github.com/Automattic/jetpack-constants/compare/v${old}...v${new}" - }, "branch-alias": { "dev-trunk": "2.0.x-dev" + }, + "changelogger": { + "link-template": "https://github.com/Automattic/jetpack-constants/compare/v${old}...v${new}" } }, "autoload": { @@ -53,112 +53,198 @@ ], "description": "A wrapper for defining constants in a more testable way.", "support": { - "source": "https://github.com/Automattic/jetpack-constants/tree/v2.0.4" + "source": "https://github.com/Automattic/jetpack-constants/tree/v2.0.5" }, - "time": "2024-08-23T14:28:14+00:00" + "time": "2024-11-04T09:23:35+00:00" }, { - "name": "oblak/wp-asset-loader", - "version": "v5.0.0", + "name": "laravel/serializable-closure", + "version": "v2.0.2", "source": { "type": "git", - "url": "https://github.com/oblakstudio/wp-asset-loader.git", - "reference": "dc1599a1430b9cd20a8a5255093ea6bdac34aaba" + "url": "https://github.com/laravel/serializable-closure.git", + "reference": "2e1a362527783bcab6c316aad51bf36c5513ae44" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/oblakstudio/wp-asset-loader/zipball/dc1599a1430b9cd20a8a5255093ea6bdac34aaba", - "reference": "dc1599a1430b9cd20a8a5255093ea6bdac34aaba", + "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/2e1a362527783bcab6c316aad51bf36c5513ae44", + "reference": "2e1a362527783bcab6c316aad51bf36c5513ae44", "shasum": "" }, "require": { - "x-wp/asset-loader": "^1" + "php": "^8.1" }, "require-dev": { - "oblak/wordpress-coding-standard": "^1", - "php-stubs/wordpress-stubs": "^6.5", - "phpstan/extension-installer": "^1.3", - "phpstan/phpstan": "^1.10", - "phpstan/phpstan-deprecation-rules": "^1.1", - "swissspidy/phpstan-no-private": "^0.2.0", - "szepeviktor/phpstan-wordpress": "^1.3" + "illuminate/support": "^10.0|^11.0|^12.0", + "nesbot/carbon": "^2.67|^3.0", + "pestphp/pest": "^2.36|^3.0", + "phpstan/phpstan": "^2.0", + "symfony/var-dumper": "^6.2.0|^7.0.0" }, - "suggest": { - "automattic/jetpack-autoloader": "Allow for better interoperability with other plugins that use this package." + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Laravel\\SerializableClosure\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + }, + { + "name": "Nuno Maduro", + "email": "nuno@laravel.com" + } + ], + "description": "Laravel Serializable Closure provides an easy and secure way to serialize closures in PHP.", + "keywords": [ + "closure", + "laravel", + "serializable" + ], + "support": { + "issues": "https://github.com/laravel/serializable-closure/issues", + "source": "https://github.com/laravel/serializable-closure" + }, + "time": "2025-01-24T15:42:37+00:00" + }, + { + "name": "php-di/invoker", + "version": "2.3.6", + "source": { + "type": "git", + "url": "https://github.com/PHP-DI/Invoker.git", + "reference": "59f15608528d8a8838d69b422a919fd6b16aa576" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-DI/Invoker/zipball/59f15608528d8a8838d69b422a919fd6b16aa576", + "reference": "59f15608528d8a8838d69b422a919fd6b16aa576", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "psr/container": "^1.0|^2.0" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "mnapoli/hard-mode": "~0.3.0", + "phpunit/phpunit": "^9.0" }, "type": "library", "autoload": { - "files": [ - "src/Utils/xwp-dep-loader-fns.php" - ], "psr-4": { - "Oblak\\WP\\": "src/Legacy/", - "XWP\\Dependency\\": "src/" + "Invoker\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "GPL-2.0-only" + "MIT" + ], + "description": "Generic and extensible callable invoker", + "homepage": "https://github.com/PHP-DI/Invoker", + "keywords": [ + "callable", + "dependency", + "dependency-injection", + "injection", + "invoke", + "invoker" ], - "description": "Simple Asset Loader for WordPress", "support": { - "issues": "https://github.com/oblakstudio/wp-asset-loader/issues", - "source": "https://github.com/oblakstudio/wp-asset-loader/tree/v5.0.0" + "issues": "https://github.com/PHP-DI/Invoker/issues", + "source": "https://github.com/PHP-DI/Invoker/tree/2.3.6" }, - "abandoned": "x-wp/asset-loader", - "time": "2024-09-17T12:38:48+00:00" + "funding": [ + { + "url": "https://github.com/mnapoli", + "type": "github" + } + ], + "time": "2025-01-17T12:49:27+00:00" }, { - "name": "oblak/wp-hook-di", - "version": "v2.1.0", + "name": "php-di/php-di", + "version": "7.0.8", "source": { "type": "git", - "url": "https://github.com/oblakstudio/wp-hook-di.git", - "reference": "e7a49e868cc44251ef479c53a8f6cb365a4749fe" + "url": "https://github.com/PHP-DI/PHP-DI.git", + "reference": "98ddc81f8f768a2ad39e4cbe737285eaeabe577a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/oblakstudio/wp-hook-di/zipball/e7a49e868cc44251ef479c53a8f6cb365a4749fe", - "reference": "e7a49e868cc44251ef479c53a8f6cb365a4749fe", + "url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/98ddc81f8f768a2ad39e4cbe737285eaeabe577a", + "reference": "98ddc81f8f768a2ad39e4cbe737285eaeabe577a", "shasum": "" }, "require": { - "automattic/jetpack-constants": "^2", - "php": ">=8.1", - "x-wp/hook-invoker": "^1" + "laravel/serializable-closure": "^1.0 || ^2.0", + "php": ">=8.0", + "php-di/invoker": "^2.0", + "psr/container": "^1.1 || ^2.0" + }, + "provide": { + "psr/container-implementation": "^1.0" }, "require-dev": { - "oblak/wordpress-coding-standard": "^1" + "friendsofphp/php-cs-fixer": "^3", + "friendsofphp/proxy-manager-lts": "^1", + "mnapoli/phpunit-easymock": "^1.3", + "phpunit/phpunit": "^9.6", + "vimeo/psalm": "^4.6" }, "suggest": { - "automattic/jetpack-autoloader": "Allow for better interoperability with other plugins that use this package." + "friendsofphp/proxy-manager-lts": "Install it if you want to use lazy injection (version ^1)" }, "type": "library", "autoload": { "files": [ - "src/Utils/oblak-wp-metadata-utils.php", - "src/Utils/oblak-wp-hook-utils.php" + "src/functions.php" ], "psr-4": { - "Oblak\\WP\\": "src" + "DI\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "GPL-2.0-only" + "MIT" ], - "authors": [ - { - "name": "Sibin Grasic", - "email": "sibin.grasic@oblak.studio" - } + "description": "The dependency injection container for humans", + "homepage": "https://php-di.org/", + "keywords": [ + "PSR-11", + "container", + "container-interop", + "dependency injection", + "di", + "ioc", + "psr11" ], - "description": "Simplifies the use of WordPress hooks by allowing you to use simple dependency injection.", "support": { - "issues": "https://github.com/oblakstudio/wp-hook-di/issues", - "source": "https://github.com/oblakstudio/wp-hook-di/tree/v2.1.0" + "issues": "https://github.com/PHP-DI/PHP-DI/issues", + "source": "https://github.com/PHP-DI/PHP-DI/tree/7.0.8" }, - "time": "2024-09-06T05:26:43+00:00" + "funding": [ + { + "url": "https://github.com/mnapoli", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/php-di/php-di", + "type": "tidelift" + } + ], + "time": "2025-01-28T21:02:46+00:00" }, { "name": "psr/container", @@ -213,24 +299,100 @@ }, "time": "2021-11-05T16:47:00+00:00" }, + { + "name": "symfony/polyfill-php81", + "version": "v1.31.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.31.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, { "name": "x-wp/asset-loader", - "version": "v1.0.0", + "version": "v1.1.2", "source": { "type": "git", "url": "https://github.com/x-wp/asset-loader.git", - "reference": "8198e2337bee579fc96a6f09e2c74fd745c98b6f" + "reference": "ff156d8238de7efa81efb60f32f0435b48323d53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/x-wp/asset-loader/zipball/8198e2337bee579fc96a6f09e2c74fd745c98b6f", - "reference": "8198e2337bee579fc96a6f09e2c74fd745c98b6f", + "url": "https://api.github.com/repos/x-wp/asset-loader/zipball/ff156d8238de7efa81efb60f32f0435b48323d53", + "reference": "ff156d8238de7efa81efb60f32f0435b48323d53", "shasum": "" }, "require": { "automattic/jetpack-constants": "^2.0", "php": ">=8.0", - "x-wp/helper-functions": "^1.9", + "x-wp/helper-functions": "^1.18", "x-wp/helper-traits": "^1.9" }, "provide": { @@ -273,35 +435,64 @@ "description": "Simple Asset Loader for WordPress", "support": { "issues": "https://github.com/x-wp/asset-loader/issues", - "source": "https://github.com/x-wp/asset-loader/tree/v1.0.0" + "source": "https://github.com/x-wp/asset-loader/tree/v1.1.2" }, - "time": "2024-09-17T12:29:39+00:00" + "time": "2024-12-08T20:43:02+00:00" }, { - "name": "x-wp/helper-classes", - "version": "v1.9.0", + "name": "x-wp/di", + "version": "v1.5.3", "source": { "type": "git", - "url": "https://github.com/x-wp/helper-classes.git", - "reference": "ec553f972ecb933e9ce374a74bc48482f8c82e14" + "url": "https://github.com/x-wp/di.git", + "reference": "2ad099f61f8b73b678e7820de474287647f4eabc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/x-wp/helper-classes/zipball/ec553f972ecb933e9ce374a74bc48482f8c82e14", - "reference": "ec553f972ecb933e9ce374a74bc48482f8c82e14", + "url": "https://api.github.com/repos/x-wp/di/zipball/2ad099f61f8b73b678e7820de474287647f4eabc", + "reference": "2ad099f61f8b73b678e7820de474287647f4eabc", "shasum": "" }, "require": { + "automattic/jetpack-constants": "^2", "php": ">=8.0", - "x-wp/helper-traits": "^1" + "php-di/php-di": "^7", + "symfony/polyfill-php81": "^1.31", + "x-wp/helper-classes": "^1.13", + "x-wp/helper-functions": "^1.13" + }, + "conflict": { + "oblak/wp-hook-di": "*" + }, + "provide": { + "psr/container-implementation": "^1.0", + "x-wp/di-implementation": "^1.0" + }, + "replace": { + "x-wp/hook-invoker": "*" + }, + "require-dev": { + "oblak/wordpress-coding-standard": "^1.1", + "php-stubs/wordpress-stubs": "^6.6", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan": "^1.12", + "phpstan/phpstan-deprecation-rules": "^1.2", + "swissspidy/phpstan-no-private": "^0.2", + "symfony/polyfill-php82": "^1.31", + "szepeviktor/phpstan-wordpress": "^1.3", + "wp-cli/wp-cli": "^2.11" }, "suggest": { "automattic/jetpack-autoloader": "Allow for better interoperability with other plugins that use this package." }, "type": "library", "autoload": { + "files": [ + "src/Functions/xwp-di-container-fns.php", + "src/Functions/xwp-di-helper-fns.php" + ], "psr-4": { - "XWP\\Helper\\Classes\\": "" + "XWP\\DI\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -314,51 +505,50 @@ "email": "sibin.grasic@oblak.studio" } ], - "description": "Generic abstraction related to xWP packages", + "description": "Provides standardized way to declare and invoke WordPress hooks", "keywords": [ - "abstractions", - "contracts", - "decoupling", - "extended-wp", - "interfaces", - "interoperability", - "standards" + "actions", + "dependency-injection", + "di", + "filters", + "hooks", + "wordpress" ], "support": { - "issues": "https://github.com/x-wp/helper-classes/issues", - "source": "https://github.com/x-wp/helper-classes/tree/v1.9.0" + "issues": "https://github.com/x-wp/hook-manager/issues", + "source": "https://github.com/x-wp/di/tree/v1.5.3" }, - "time": "2024-09-06T04:28:11+00:00" + "time": "2025-01-30T22:48:02+00:00" }, { - "name": "x-wp/helper-functions", - "version": "v1.9.0", + "name": "x-wp/helper-classes", + "version": "v1.18.1", "source": { "type": "git", - "url": "https://github.com/x-wp/helper-functions.git", - "reference": "951890a5352d2c293c086e20affb7aa6d8cc2fd8" + "url": "https://github.com/x-wp/helper-classes.git", + "reference": "451dff53964c2fbdf086882c868709e4e36fb1cd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/x-wp/helper-functions/zipball/951890a5352d2c293c086e20affb7aa6d8cc2fd8", - "reference": "951890a5352d2c293c086e20affb7aa6d8cc2fd8", + "url": "https://api.github.com/repos/x-wp/helper-classes/zipball/451dff53964c2fbdf086882c868709e4e36fb1cd", + "reference": "451dff53964c2fbdf086882c868709e4e36fb1cd", "shasum": "" }, "require": { - "php": ">=8.0" + "php": ">=8.0", + "x-wp/helper-traits": "^1" }, "suggest": { "automattic/jetpack-autoloader": "Allow for better interoperability with other plugins that use this package." }, "type": "library", "autoload": { - "files": [ - "xwp-helper-fns.php", - "xwp-helper-fns-req.php" - ], "psr-4": { - "XWP\\Helper\\Functions\\": "." - } + "XWP\\Helper\\Classes\\": "" + }, + "classmap": [ + "WP/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -370,34 +560,34 @@ "email": "sibin.grasic@oblak.studio" } ], - "description": "Various traits related to xWP packages", + "description": "Generic abstraction related to xWP packages", "keywords": [ + "abstractions", "contracts", "decoupling", "extended-wp", "interfaces", "interoperability", - "standards", - "traits" + "standards" ], "support": { - "issues": "https://github.com/x-wp/helper-functions/issues", - "source": "https://github.com/x-wp/helper-functions/tree/v1.9.0" + "issues": "https://github.com/x-wp/helper-classes/issues", + "source": "https://github.com/x-wp/helper-classes/tree/v1.18.1" }, - "time": "2024-09-07T15:40:44+00:00" + "time": "2024-09-23T14:31:15+00:00" }, { - "name": "x-wp/helper-traits", - "version": "v1.9.0", + "name": "x-wp/helper-functions", + "version": "v1.18.1", "source": { "type": "git", - "url": "https://github.com/x-wp/helper-traits.git", - "reference": "485d1e932e133d2919756abd82d3d989b47e111a" + "url": "https://github.com/x-wp/helper-functions.git", + "reference": "edd258d0b2ad90a78893ffcabf6626cebf56a281" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/x-wp/helper-traits/zipball/485d1e932e133d2919756abd82d3d989b47e111a", - "reference": "485d1e932e133d2919756abd82d3d989b47e111a", + "url": "https://api.github.com/repos/x-wp/helper-functions/zipball/edd258d0b2ad90a78893ffcabf6626cebf56a281", + "reference": "edd258d0b2ad90a78893ffcabf6626cebf56a281", "shasum": "" }, "require": { @@ -408,8 +598,14 @@ }, "type": "library", "autoload": { + "files": [ + "xwp-helper-fns-arr.php", + "xwp-helper-fns-num.php", + "xwp-helper-fns-req.php", + "xwp-helper-fns.php" + ], "psr-4": { - "XWP\\Helper\\Traits\\": "" + "XWP\\Helper\\Functions\\": "." } }, "notification-url": "https://packagist.org/downloads/", @@ -433,27 +629,27 @@ "traits" ], "support": { - "issues": "https://github.com/x-wp/helper-traits/issues", - "source": "https://github.com/x-wp/helper-traits/tree/v1.9.0" + "issues": "https://github.com/x-wp/helper-functions/issues", + "source": "https://github.com/x-wp/helper-functions/tree/v1.18.1" }, - "time": "2024-09-07T15:21:49+00:00" + "time": "2024-11-04T00:58:34+00:00" }, { - "name": "x-wp/hook-contracts", - "version": "v1.5.0", + "name": "x-wp/helper-traits", + "version": "v1.18.1", "source": { "type": "git", - "url": "https://github.com/x-wp/hook-contracts.git", - "reference": "8aa2190f7cc49ff7c3075a42cbd727966127a4a9" + "url": "https://github.com/x-wp/helper-traits.git", + "reference": "0367d136d6ba36e2ae0fe1854584ef760ea7cae9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/x-wp/hook-contracts/zipball/8aa2190f7cc49ff7c3075a42cbd727966127a4a9", - "reference": "8aa2190f7cc49ff7c3075a42cbd727966127a4a9", + "url": "https://api.github.com/repos/x-wp/helper-traits/zipball/0367d136d6ba36e2ae0fe1854584ef760ea7cae9", + "reference": "0367d136d6ba36e2ae0fe1854584ef760ea7cae9", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.0" }, "suggest": { "automattic/jetpack-autoloader": "Allow for better interoperability with other plugins that use this package." @@ -461,7 +657,7 @@ "type": "library", "autoload": { "psr-4": { - "XWP\\Contracts\\Hook\\": "" + "XWP\\Helper\\Traits\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -474,94 +670,21 @@ "email": "sibin.grasic@oblak.studio" } ], - "description": "Generic abstraction related to xWP hooks", + "description": "Various traits related to xWP packages", "keywords": [ - "HOOK", - "abstractions", "contracts", "decoupling", "extended-wp", "interfaces", "interoperability", - "standards" - ], - "support": { - "issues": "https://github.com/x-wp/hook-contracts/issues", - "source": "https://github.com/x-wp/hook-contracts/tree/v1.5.0" - }, - "time": "2024-09-06T04:29:49+00:00" - }, - { - "name": "x-wp/hook-invoker", - "version": "v1.1.0", - "source": { - "type": "git", - "url": "https://github.com/x-wp/hook-invoker.git", - "reference": "2e4c947373726af601ad77ddb7774c2d0b9c72a5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/x-wp/hook-invoker/zipball/2e4c947373726af601ad77ddb7774c2d0b9c72a5", - "reference": "2e4c947373726af601ad77ddb7774c2d0b9c72a5", - "shasum": "" - }, - "require": { - "automattic/jetpack-constants": "^2.0", - "php": ">=8.1", - "psr/container": "^2.0", - "x-wp/helper-classes": "^1.3", - "x-wp/helper-functions": "^1.6", - "x-wp/hook-contracts": "^1" - }, - "provide": { - "x-wp/hook-implementation": "1.0.0" - }, - "require-dev": { - "oblak/wordpress-coding-standard": "^1", - "php-stubs/woocommerce-stubs": "^9.0", - "php-stubs/wordpress-stubs": "^6.5", - "phpstan/extension-installer": "^1.3", - "phpstan/phpstan": "^1.10", - "phpstan/phpstan-deprecation-rules": "^1.1", - "swissspidy/phpstan-no-private": "^0.2.0", - "szepeviktor/phpstan-wordpress": "^1.3" - }, - "suggest": { - "automattic/jetpack-autoloader": "Allow for better interoperability with other plugins that use this package." - }, - "type": "library", - "autoload": { - "files": [ - "src/Functions/xwp-hook-helper-fns.php" - ], - "psr-4": { - "XWP\\Hook\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0-only" - ], - "authors": [ - { - "name": "Sibin Grasic", - "email": "sibin.grasic@oblak.studio" - } - ], - "description": "Provides standardized way to declare and invoke WordPress hooks", - "keywords": [ - "actions", - "extended-wp", - "filters", - "hook-manager", - "hooks", - "wordpress" + "standards", + "traits" ], "support": { - "issues": "https://github.com/x-wp/hook-manager/issues", - "source": "https://github.com/x-wp/hook-invoker/tree/v1.1.0" + "issues": "https://github.com/x-wp/helper-traits/issues", + "source": "https://github.com/x-wp/helper-traits/tree/v1.18.1" }, - "time": "2024-09-06T05:08:22+00:00" + "time": "2024-09-18T12:43:44+00:00" } ], "packages-dev": [ @@ -645,27 +768,27 @@ }, { "name": "oblak/wordpress-coding-standard", - "version": "v1.1.1", + "version": "v1.2.6", "source": { "type": "git", "url": "https://github.com/oblakstudio/wordpress-coding-standards.git", - "reference": "b1f62524c09c639a9fdf4272ad3fd113259a8952" + "reference": "5b93e77b6faa931b6eb160d73913a566236de3cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/oblakstudio/wordpress-coding-standards/zipball/b1f62524c09c639a9fdf4272ad3fd113259a8952", - "reference": "b1f62524c09c639a9fdf4272ad3fd113259a8952", + "url": "https://api.github.com/repos/oblakstudio/wordpress-coding-standards/zipball/5b93e77b6faa931b6eb160d73913a566236de3cb", + "reference": "5b93e77b6faa931b6eb160d73913a566236de3cb", "shasum": "" }, "require": { "ext-filter": "*", "php": ">=7.4", - "phpcompatibility/php-compatibility": "9.3.5", - "phpcompatibility/phpcompatibility-wp": "2.1.4", - "phpcsstandards/phpcsextra": "1.1.0", - "phpcsstandards/phpcsutils": "1.0.8", + "phpcompatibility/php-compatibility": "^9", + "phpcompatibility/phpcompatibility-wp": "^2.1", + "phpcsstandards/phpcsextra": "^1.1", + "phpcsstandards/phpcsutils": "^1.0", "slevomat/coding-standard": "^8.14", - "squizlabs/php_codesniffer": "3.8.1", + "squizlabs/php_codesniffer": "^3.8", "wp-coding-standards/wpcs": "^3" }, "require-dev": { @@ -693,22 +816,22 @@ ], "support": { "issues": "https://github.com/oblakstudio/wordpress-coding-standards/issues", - "source": "https://github.com/oblakstudio/wordpress-coding-standards/tree/v1.1.1" + "source": "https://github.com/oblakstudio/wordpress-coding-standards/tree/v1.2.6" }, - "time": "2024-01-24T23:43:48+00:00" + "time": "2025-01-23T16:14:04+00:00" }, { "name": "php-stubs/wordpress-stubs", - "version": "v6.6.0", + "version": "v6.7.1", "source": { "type": "git", "url": "https://github.com/php-stubs/wordpress-stubs.git", - "reference": "86e8753e89d59849276dcdd91b9a7dd78bb4abe2" + "reference": "83448e918bf06d1ed3d67ceb6a985fc266a02fd1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/86e8753e89d59849276dcdd91b9a7dd78bb4abe2", - "reference": "86e8753e89d59849276dcdd91b9a7dd78bb4abe2", + "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/83448e918bf06d1ed3d67ceb6a985fc266a02fd1", + "reference": "83448e918bf06d1ed3d67ceb6a985fc266a02fd1", "shasum": "" }, "require-dev": { @@ -717,9 +840,9 @@ "php": "^7.4 || ^8.0", "php-stubs/generator": "^0.8.3", "phpdocumentor/reflection-docblock": "^5.4.1", - "phpstan/phpstan": "^1.10.49", + "phpstan/phpstan": "^1.11", "phpunit/phpunit": "^9.5", - "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^1.0", + "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^1.1.1", "wp-coding-standards/wpcs": "3.1.0 as 2.3.0" }, "suggest": { @@ -741,9 +864,9 @@ ], "support": { "issues": "https://github.com/php-stubs/wordpress-stubs/issues", - "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.6.0" + "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.7.1" }, - "time": "2024-07-17T08:50:38+00:00" + "time": "2024-11-24T03:57:09+00:00" }, { "name": "phpcompatibility/php-compatibility", @@ -881,16 +1004,16 @@ }, { "name": "phpcompatibility/phpcompatibility-wp", - "version": "2.1.4", + "version": "2.1.6", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", - "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5" + "reference": "80ccb1a7640995edf1b87a4409fa584cd5869469" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", - "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/80ccb1a7640995edf1b87a4409fa584cd5869469", + "reference": "80ccb1a7640995edf1b87a4409fa584cd5869469", "shasum": "" }, "require": { @@ -898,10 +1021,10 @@ "phpcompatibility/phpcompatibility-paragonie": "^1.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7" + "dealerdirect/phpcodesniffer-composer-installer": "^1.0" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." }, "type": "phpcodesniffer-standard", @@ -930,35 +1053,50 @@ ], "support": { "issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues", + "security": "https://github.com/PHPCompatibility/PHPCompatibilityWP/security/policy", "source": "https://github.com/PHPCompatibility/PHPCompatibilityWP" }, - "time": "2022-10-24T09:00:36+00:00" + "funding": [ + { + "url": "https://github.com/PHPCompatibility", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2025-01-16T22:34:19+00:00" }, { "name": "phpcsstandards/phpcsextra", - "version": "1.1.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHPCSExtra.git", - "reference": "61a9be9f74a53735f7c421d7de8dc64fa80488e6" + "reference": "11d387c6642b6e4acaf0bd9bf5203b8cca1ec489" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/61a9be9f74a53735f7c421d7de8dc64fa80488e6", - "reference": "61a9be9f74a53735f7c421d7de8dc64fa80488e6", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/11d387c6642b6e4acaf0bd9bf5203b8cca1ec489", + "reference": "11d387c6642b6e4acaf0bd9bf5203b8cca1ec489", "shasum": "" }, "require": { "php": ">=5.4", - "phpcsstandards/phpcsutils": "^1.0.8", - "squizlabs/php_codesniffer": "^3.7.1" + "phpcsstandards/phpcsutils": "^1.0.9", + "squizlabs/php_codesniffer": "^3.8.0" }, "require-dev": { "php-parallel-lint/php-console-highlighter": "^1.0", "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcsstandards/phpcsdevcs": "^1.1.6", "phpcsstandards/phpcsdevtools": "^1.2.1", - "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" }, "type": "phpcodesniffer-standard", "extra": { @@ -993,35 +1131,50 @@ ], "support": { "issues": "https://github.com/PHPCSStandards/PHPCSExtra/issues", + "security": "https://github.com/PHPCSStandards/PHPCSExtra/security/policy", "source": "https://github.com/PHPCSStandards/PHPCSExtra" }, - "time": "2023-07-19T19:40:11+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" + } + ], + "time": "2023-12-08T16:49:07+00:00" }, { "name": "phpcsstandards/phpcsutils", - "version": "1.0.8", + "version": "1.0.12", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHPCSUtils.git", - "reference": "69465cab9d12454e5e7767b9041af0cd8cd13be7" + "reference": "87b233b00daf83fb70f40c9a28692be017ea7c6c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/69465cab9d12454e5e7767b9041af0cd8cd13be7", - "reference": "69465cab9d12454e5e7767b9041af0cd8cd13be7", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/87b233b00daf83fb70f40c9a28692be017ea7c6c", + "reference": "87b233b00daf83fb70f40c9a28692be017ea7c6c", "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.7.1 || 4.0.x-dev@dev" + "squizlabs/php_codesniffer": "^3.10.0 || 4.0.x-dev@dev" }, "require-dev": { "ext-filter": "*", "php-parallel-lint/php-console-highlighter": "^1.0", "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcsstandards/phpcsdevcs": "^1.1.6", - "yoast/phpunit-polyfills": "^1.0.5 || ^2.0.0" + "yoast/phpunit-polyfills": "^1.1.0 || ^2.0.0" }, "type": "phpcodesniffer-standard", "extra": { @@ -1066,9 +1219,24 @@ "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" }, - "time": "2023-07-16T21:39:41+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" + } + ], + "time": "2024-05-20T13:34:27+00:00" }, { "name": "phpstan/extension-installer", @@ -1120,16 +1288,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.30.1", + "version": "1.33.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "51b95ec8670af41009e2b2b56873bad96682413e" + "reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/51b95ec8670af41009e2b2b56873bad96682413e", - "reference": "51b95ec8670af41009e2b2b56873bad96682413e", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/82a311fd3690fb2bf7b64d5c98f912b3dd746140", + "reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140", "shasum": "" }, "require": { @@ -1161,22 +1329,22 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.30.1" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.33.0" }, - "time": "2024-09-07T20:13:05+00:00" + "time": "2024-10-13T11:25:22+00:00" }, { "name": "phpstan/phpstan", - "version": "1.12.3", + "version": "1.12.16", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009" + "reference": "e0bb5cb78545aae631220735aa706eac633a6be9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0fcbf194ab63d8159bb70d9aa3e1350051632009", - "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e0bb5cb78545aae631220735aa706eac633a6be9", + "reference": "e0bb5cb78545aae631220735aa706eac633a6be9", "shasum": "" }, "require": { @@ -1221,7 +1389,7 @@ "type": "github" } ], - "time": "2024-09-09T08:10:35+00:00" + "time": "2025-01-21T14:50:05+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -1272,32 +1440,32 @@ }, { "name": "slevomat/coding-standard", - "version": "8.14.1", + "version": "8.15.0", "source": { "type": "git", "url": "https://github.com/slevomat/coding-standard.git", - "reference": "fea1fd6f137cc84f9cba0ae30d549615dbc6a926" + "reference": "7d1d957421618a3803b593ec31ace470177d7817" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/fea1fd6f137cc84f9cba0ae30d549615dbc6a926", - "reference": "fea1fd6f137cc84f9cba0ae30d549615dbc6a926", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/7d1d957421618a3803b593ec31ace470177d7817", + "reference": "7d1d957421618a3803b593ec31ace470177d7817", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0", "php": "^7.2 || ^8.0", "phpstan/phpdoc-parser": "^1.23.1", - "squizlabs/php_codesniffer": "^3.7.1" + "squizlabs/php_codesniffer": "^3.9.0" }, "require-dev": { "phing/phing": "2.17.4", "php-parallel-lint/php-parallel-lint": "1.3.2", - "phpstan/phpstan": "1.10.37", + "phpstan/phpstan": "1.10.60", "phpstan/phpstan-deprecation-rules": "1.1.4", - "phpstan/phpstan-phpunit": "1.3.14", - "phpstan/phpstan-strict-rules": "1.5.1", - "phpunit/phpunit": "8.5.21|9.6.8|10.3.5" + "phpstan/phpstan-phpunit": "1.3.16", + "phpstan/phpstan-strict-rules": "1.5.2", + "phpunit/phpunit": "8.5.21|9.6.8|10.5.11" }, "type": "phpcodesniffer-standard", "extra": { @@ -1321,7 +1489,7 @@ ], "support": { "issues": "https://github.com/slevomat/coding-standard/issues", - "source": "https://github.com/slevomat/coding-standard/tree/8.14.1" + "source": "https://github.com/slevomat/coding-standard/tree/8.15.0" }, "funding": [ { @@ -1333,20 +1501,20 @@ "type": "tidelift" } ], - "time": "2023-10-08T07:28:08+00:00" + "time": "2024-03-09T15:20:58+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.8.1", + "version": "3.11.3", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "14f5fff1e64118595db5408e946f3a22c75807f7" + "reference": "ba05f990e79cbe69b9f35c8c1ac8dca7eecc3a10" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/14f5fff1e64118595db5408e946f3a22c75807f7", - "reference": "14f5fff1e64118595db5408e946f3a22c75807f7", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/ba05f990e79cbe69b9f35c8c1ac8dca7eecc3a10", + "reference": "ba05f990e79cbe69b9f35c8c1ac8dca7eecc3a10", "shasum": "" }, "require": { @@ -1411,9 +1579,13 @@ { "url": "https://opencollective.com/php_codesniffer", "type": "open_collective" + }, + { + "url": "https://thanks.dev/phpcsstandards", + "type": "thanks_dev" } ], - "time": "2024-01-11T20:47:48+00:00" + "time": "2025-01-23T17:04:15+00:00" }, { "name": "swissspidy/phpstan-no-private", @@ -1468,16 +1640,16 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v3.5.0", + "version": "v3.5.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" + "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", - "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", + "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", "shasum": "" }, "require": { @@ -1485,12 +1657,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, "branch-alias": { "dev-main": "3.5-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -1515,7 +1687,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1" }, "funding": [ { @@ -1531,7 +1703,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2024-09-25T14:20:29+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -1559,8 +1731,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -1633,8 +1805,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -1691,16 +1863,16 @@ }, { "name": "symfony/var-dumper", - "version": "v6.4.11", + "version": "v6.4.18", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "ee14c8254a480913268b1e3b1cba8045ed122694" + "reference": "4ad10cf8b020e77ba665305bb7804389884b4837" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/ee14c8254a480913268b1e3b1cba8045ed122694", - "reference": "ee14c8254a480913268b1e3b1cba8045ed122694", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/4ad10cf8b020e77ba665305bb7804389884b4837", + "reference": "4ad10cf8b020e77ba665305bb7804389884b4837", "shasum": "" }, "require": { @@ -1756,7 +1928,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v6.4.11" + "source": "https://github.com/symfony/var-dumper/tree/v6.4.18" }, "funding": [ { @@ -1772,7 +1944,7 @@ "type": "tidelift" } ], - "time": "2024-08-30T16:03:21+00:00" + "time": "2025-01-17T11:26:11+00:00" }, { "name": "szepeviktor/phpstan-wordpress", @@ -1839,16 +2011,16 @@ }, { "name": "wp-coding-standards/wpcs", - "version": "3.0.1", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", - "reference": "b4caf9689f1a0e4a4c632679a44e638c1c67aff1" + "reference": "9333efcbff231f10dfd9c56bb7b65818b4733ca7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/b4caf9689f1a0e4a4c632679a44e638c1c67aff1", - "reference": "b4caf9689f1a0e4a4c632679a44e638c1c67aff1", + "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/9333efcbff231f10dfd9c56bb7b65818b4733ca7", + "reference": "9333efcbff231f10dfd9c56bb7b65818b4733ca7", "shasum": "" }, "require": { @@ -1857,16 +2029,16 @@ "ext-tokenizer": "*", "ext-xmlreader": "*", "php": ">=5.4", - "phpcsstandards/phpcsextra": "^1.1.0", - "phpcsstandards/phpcsutils": "^1.0.8", - "squizlabs/php_codesniffer": "^3.7.2" + "phpcsstandards/phpcsextra": "^1.2.1", + "phpcsstandards/phpcsutils": "^1.0.10", + "squizlabs/php_codesniffer": "^3.9.0" }, "require-dev": { "php-parallel-lint/php-console-highlighter": "^1.0.0", "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9.0", "phpcsstandards/phpcsdevtools": "^1.2.0", - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" }, "suggest": { "ext-iconv": "For improved results", @@ -1897,11 +2069,11 @@ }, "funding": [ { - "url": "https://opencollective.com/thewpcc/contribute/wp-php-63406", + "url": "https://opencollective.com/php_codesniffer", "type": "custom" } ], - "time": "2023-09-14T07:06:09+00:00" + "time": "2024-03-25T16:39:00+00:00" } ], "aliases": [], diff --git a/src/Builder.php b/src/Builder.php new file mode 100644 index 0000000..606a214 --- /dev/null +++ b/src/Builder.php @@ -0,0 +1,112 @@ + + */ + private static array $handlers; + + /** + * Modules to import. + * + * @var array + */ + private static array $modules; + + /** + * Configuration array. + * + * @var array + */ + private static array $config; + + /** + * Build the theme. + * + * @param array $modules Array of submodules to import. + * @param array $handlers Array of handlers to register. + * @param string $textdomain Textdomain. + * @param string $version Version. + */ + public static function build( array $modules, array $handlers, string $textdomain, string $version ): void { + if ( self::$built ) { + return; + } + + self::$built = true; + self::$handlers = $handlers; + self::$modules = $modules; + self::$config = array( + 'cfg.textdomain' => $textdomain, + 'cfg.version' => $version, + ); + + \add_filter( 'xwp_extend_import_extremis', array( self::class, 'set_imports' ), 10, 2 ); + \add_filter( 'xwp_extend_handlers_extremis', array( self::class, 'set_handlers' ), 10, 2 ); + \add_filter( 'xwp_extend_config_extremis', array( self::class, 'set_config' ), 10, 2 ); + + \xwp_load_app( + array( + 'compile_dir' => \get_stylesheet_directory() . 'compile', + 'id' => 'extremis', + 'module' => Theme::class, + ), + hook: 'after_setup_theme', + priority: -1001, + ); + } + + /** + * Set the Extremis handlers. + * + * @param array $handlers Handlers. + * @return array + */ + public static function set_handlers( array $handlers ): array { + return \array_merge( $handlers, self::$handlers ); + } + + /** + * Set the Extremis imports. + * + * @param array $imports Imports. + * @param class-string $classname Classname. + * @return array + */ + public static function set_imports( array $imports, string $classname ): array { + if ( Theme::class === $classname ) { + $imports = \array_merge( $imports, self::$modules ); + } + + return $imports; + } + + /** + * Set the Extremis configuration. + * + * @param array $config Configuration. + * @return array + */ + public static function set_config( array $config ): array { + return \array_merge( $config, self::$config ); + } +} diff --git a/src/Compat/Extremis_Legacy.php b/src/Compat/Extremis_Legacy.php deleted file mode 100644 index f720050..0000000 --- a/src/Compat/Extremis_Legacy.php +++ /dev/null @@ -1,18 +0,0 @@ - + */ +#[\Attribute( \Attribute::TARGET_CLASS )] +class Theme_Module extends Module { + /** + * Constructor. + */ + public function __construct() { + parent::__construct( + container: 'extremis', + hook: 'after_setup_theme', + priority: -1000, + extendable: true, + ); + } + + /** + * Set the handlers. + */ + protected function set_handlers(): void { + $this->handlers = \apply_filters( 'xwp_extend_handlers_extremis', $this->handlers ); + } + + /** + * Extend the module definition. + * + * @return array + */ + protected function extend_definition(): array { + return \apply_filters( 'xwp_extend_config_extremis', array() ); + } + + /** + * Initialize the module. + * + * @return bool + */ + public function on_initialize(): bool { + $this->set_handlers(); + + return parent::on_initialize(); + } + + /** + * Get the module definition. + * + * @return array + */ + public function get_definition(): array { + return \array_merge( + parent::get_definition(), + $this->extend_definition(), + ); + } +} diff --git a/src/Extremis.php b/src/Extremis.php deleted file mode 100644 index 7cf8f92..0000000 --- a/src/Extremis.php +++ /dev/null @@ -1,139 +0,0 @@ -|false - */ - private array|bool $assets; - - /** - * Class constructor - */ - private function __construct() { - $this->bundle_id = $this->get_namespace(); - $this->assets = $this->get_assets(); - - $this->init( 'after_setup_theme', -1 ); - } - - /** - * Returns the theme namespace - * - * @return string - */ - protected function get_namespace(): string { - return Constants::get_constant( 'EXTREMIS_NAMESPACE' ) ?? 'extremis'; - } - - /** - * Returns the asset config array - * - * @return array|false - */ - protected function get_assets(): array|bool { - $file = \locate_template( '/config/assets.php' ); - - if ( ! $file ) { - return false; - } - - return \xwp_array_diff_assoc( - \array_merge( require $file, array( 'id' => $this->bundle_id ) ), - 'namespace', - ); - } - - /** - * {@inheritDoc} - */ - protected function get_dependencies(): array { - return require \locate_template( '/config/dependencies.php' ); - } - - /** - * {@inheritDoc} - */ - public function run_hooks() { - \xwp_invoke_hooked_methods( $this ); - } - - /** - * Loads the textdomain - */ - #[Action( tag: 'after_setup_theme', priority: 1 )] - public function load_textdomain() { - \load_child_theme_textdomain( - Constants::get_constant( 'EXTREMIS_TEXTDOMAIN' ) ?? 'extremis', - \get_stylesheet_directory() . '/languages', - ); - } - - /** - * Initializes the asset loader. - */ - #[Action( tag: 'after_setup_theme', priority: 1 )] - public function init_asset_loader() { - if ( ! $this->assets ) { - return; - } - - ! isset( $this->assets['base_dir'] ) - ? Asset_Loader::get_instance()->register_namespace( $this->bundle_id, $this->assets ) - : \XWP_Asset_Loader::load_bundle( $this->assets ); - } - - /** - * Initialies widgets - */ - #[Action( tag: 'widgets_init', priority: 10 )] - public function init_widgets() { - foreach ( $this->get_dependencies() as $dep ) { - if ( ! \str_contains( $dep, 'Widget' ) ) { - continue; - } - - \register_widget( $dep ); - } - } - - /** - * Adds the current page slug to the body class. - * - * @param string[] $classes Current body classes. - * @return string[] Modified body classes. - */ - #[Filter( tag: 'body_class', priority: 10 )] - public function modify_body_class( array $classes ): array { - if ( \is_single() || \is_page() && ! \is_front_page() ) { - if ( ! \in_array( \basename( \get_permalink() ), $classes, true ) ) { - $classes[] = \basename( \get_permalink() ); - } - } - - return \array_filter( $classes ); - } -} diff --git a/src/Theme.php b/src/Theme.php new file mode 100644 index 0000000..63b0b0a --- /dev/null +++ b/src/Theme.php @@ -0,0 +1,103 @@ + + */ + public static function configure(): array { + $definition = \locate_template( '/config/definition.php' ); + + return $definition + ? require $definition + : array(); + } + + /** + * Loads the textdomain + * + * @param \DI\Container $cnt Container. Injected. + */ + #[Action( + tag: 'after_setup_theme', + priority: 1, + invoke: Action::INV_PROXIED, + args: 0, + params: array( + \DI\Container::class, + ), + )] + public function load_textdomain( \DI\Container $cnt ): void { + \load_child_theme_textdomain( + $cnt->get( 'cfg.textdomain' ), + \get_stylesheet_directory() . '/languages', + ); + } + + /** + * Enqueue assets + * + * @param \DI\Container $cnt Container. Injected. + */ + #[Action( + tag: 'after_setup_theme', + priority: 1, + context: Action::CTX_FRONTEND | Action::CTX_ADMIN, + invoke: Action::INV_PROXIED, + args: 0, + params: array( + \DI\Container::class, + ), + )] + public function enqueue_assets( \DI\Container $cnt ): void { + if ( ! $cnt->has( 'cfg.assets' ) ) { + return; + } + $bundle = $cnt->get( 'cfg.assets' ); + $bundle['base_uri'] = \get_theme_file_uri( '/dist' ); + $bundle['base_dir'] = \get_theme_file_path( '/dist' ); + $bundle['id'] ??= 'extremis'; + $bundle['manifest'] = 'assets.php'; + $bundle['version'] = $cnt->get( 'cfg.version' ); + + $cnt->set( + \XWP_Asset_Bundle::class, + \XWP_Asset_Loader::load_bundle( $bundle )->get_bundle( $bundle['id'] ), + ); + } + + /** + * Add custom body classes + * + * @param array $classes Body classes. + * @return array + */ + #[Filter( tag: 'body_class', priority: 10, context: Filter::CTX_FRONTEND )] + public function change_body_class( array $classes ): array { + if ( ( \is_single() || \is_page() ) && ! \is_front_page() ) { + $page_class = \basename( \get_permalink() ); + + if ( ! \in_array( $page_class, $classes, true ) ) { + $classes[] = $page_class; + } + } + + return \array_filter( $classes ); + } +} diff --git a/src/Utils/extremis-helpers.php b/src/Utils/extremis-helpers.php index 99f266e..ebd4753 100644 --- a/src/Utils/extremis-helpers.php +++ b/src/Utils/extremis-helpers.php @@ -6,13 +6,30 @@ * @subpackage Utils */ -use Oblak\WP\Extremis; +use XWP\Extremis\Builder; /** - * Returns the main instance of Extremis. + * Initialize the eXtremis application. * - * @return Extremis + * @param array $modules Array of submodules to import. + * @param array $handlers Array of handlers to register. + * @param string $textdomain Textdomain. + * @param string $version Version. */ -function Extremis(): Extremis { - return Extremis::instance(); +function extremis_init( + array $modules = array(), + array $handlers = array(), + string $textdomain = 'extremis', + string $version = '0.0.0', +) { + Builder::build( $modules, $handlers, $textdomain, $version ); +} + +/** + * Get the eXtremis container. + * + * @return DI\Container + */ +function Extremis(): DI\Container { + return xwp_app( 'extremis' ); }