From 3b11501766ef70a1cbc69d605ed740458ad9342a Mon Sep 17 00:00:00 2001 From: Ivan Klimchuk Date: Sun, 2 Apr 2023 15:56:27 +0300 Subject: [PATCH 1/5] Upgrade fenom to v3 with php 8 support --- core/components/pdotools/composer.json | 2 +- core/components/pdotools/composer.lock | 27 +++++++++++++------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/core/components/pdotools/composer.json b/core/components/pdotools/composer.json index 27f49325..30b3aa35 100644 --- a/core/components/pdotools/composer.json +++ b/core/components/pdotools/composer.json @@ -2,6 +2,6 @@ "name": "bezumkin/pdotools", "type": "library", "require": { - "fenom/fenom": "2.*" + "fenom/fenom": "3.*" } } diff --git a/core/components/pdotools/composer.lock b/core/components/pdotools/composer.lock index a8a73e9e..94102cca 100644 --- a/core/components/pdotools/composer.lock +++ b/core/components/pdotools/composer.lock @@ -4,34 +4,33 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5722bbf5b6cd9e745169bc308c88ecd3", + "content-hash": "fd7de43fdf50f5f253a6b354302c5803", "packages": [ { "name": "fenom/fenom", - "version": "2.12.0", + "version": "v3.0.0", "source": { "type": "git", "url": "https://github.com/fenom-template/fenom.git", - "reference": "f0cb251843de469b453b15c158cf0d1589d4de6d" + "reference": "fbf4f46f1fe1d7d3cc342996e8e71d42b6b1ecdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fenom-template/fenom/zipball/f0cb251843de469b453b15c158cf0d1589d4de6d", - "reference": "f0cb251843de469b453b15c158cf0d1589d4de6d", + "url": "https://api.github.com/repos/fenom-template/fenom/zipball/fbf4f46f1fe1d7d3cc342996e8e71d42b6b1ecdb", + "reference": "fbf4f46f1fe1d7d3cc342996e8e71d42b6b1ecdb", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=5.3.0" + "php": ">=8.0.0" }, "require-dev": { - "phpunit/phpunit": "<6.0", - "satooshi/php-coveralls": "*" + "phpunit/phpunit": "9.*" }, "type": "library", "autoload": { - "psr-0": { - "Fenom\\": "src/" + "psr-4": { + "Fenom\\": "src/Fenom" }, "classmap": [ "src/Fenom.php" @@ -39,7 +38,7 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3" + "BSD-3-Clause" ], "authors": [ { @@ -56,9 +55,9 @@ ], "support": { "issues": "https://github.com/fenom-template/fenom/issues", - "source": "https://github.com/fenom-template/fenom/tree/2.12.0" + "source": "https://github.com/fenom-template/fenom/tree/v3.0.0" }, - "time": "2020-07-06T17:02:31+00:00" + "time": "2023-02-27T08:38:43+00:00" } ], "packages-dev": [], @@ -69,5 +68,5 @@ "prefer-lowest": false, "platform": [], "platform-dev": [], - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.3.0" } From e320591b7cdcd6031432bfc89dd5a39bfdea9da6 Mon Sep 17 00:00:00 2001 From: Ivan Klimchuk Date: Sun, 2 Apr 2023 16:42:42 +0300 Subject: [PATCH 2/5] chore: make signatures compatible with new fenom --- .../pdotools/model/fenom/Providers/ModChunk.php | 10 +++++----- .../pdotools/model/fenom/Providers/ModTemplate.php | 10 +++++----- core/components/pdotools/model/pdotools/_fenom.php | 1 - 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/core/components/pdotools/model/fenom/Providers/ModChunk.php b/core/components/pdotools/model/fenom/Providers/ModChunk.php index ac07d19f..b1c22409 100644 --- a/core/components/pdotools/model/fenom/Providers/ModChunk.php +++ b/core/components/pdotools/model/fenom/Providers/ModChunk.php @@ -20,7 +20,7 @@ function __construct(pdoTools $pdoTools) * * @return bool */ - public function templateExists($tpl) + public function templateExists(string $tpl): bool { $c = is_numeric($tpl) && $tpl > 0 ? $tpl @@ -36,7 +36,7 @@ public function templateExists($tpl) * * @return string */ - public function getSource($tpl, &$time) + public function getSource(string $tpl, float &$time): string { $content = ''; if ($pos = strpos($tpl, '@')) { @@ -76,7 +76,7 @@ public function getSource($tpl, &$time) * * @return int */ - public function getLastModified($tpl) + public function getLastModified(string $tpl): float { $c = is_numeric($tpl) && $tpl > 0 ? $tpl @@ -99,7 +99,7 @@ public function getLastModified($tpl) * * @return bool if true - all templates are valid else some templates are invalid */ - public function verify(array $templates) + public function verify(array $templates): bool { return true; } @@ -109,7 +109,7 @@ public function verify(array $templates) * Get all names of template from provider * @return array|\Iterator */ - public function getList() + public function getList(string $extension = "tpl"): iterable { $c = $this->modx->newQuery('modChunk'); $c->select('name'); diff --git a/core/components/pdotools/model/fenom/Providers/ModTemplate.php b/core/components/pdotools/model/fenom/Providers/ModTemplate.php index 2ded26da..ac7132ee 100644 --- a/core/components/pdotools/model/fenom/Providers/ModTemplate.php +++ b/core/components/pdotools/model/fenom/Providers/ModTemplate.php @@ -20,7 +20,7 @@ function __construct(pdoTools $pdoTools) * * @return bool */ - public function templateExists($tpl) + public function templateExists(string $tpl): bool { $c = is_numeric($tpl) && $tpl > 0 ? $tpl @@ -36,7 +36,7 @@ public function templateExists($tpl) * * @return string */ - public function getSource($tpl, &$time) + public function getSource(string $tpl, float &$time): string { $content = ''; if ($pos = strpos($tpl, '@')) { @@ -76,7 +76,7 @@ public function getSource($tpl, &$time) * * @return int */ - public function getLastModified($tpl) + public function getLastModified(string $tpl): float { $c = is_numeric($tpl) && $tpl > 0 ? $tpl @@ -99,7 +99,7 @@ public function getLastModified($tpl) * * @return bool if true - all templates are valid else some templates are invalid */ - public function verify(array $templates) + public function verify(array $templates): bool { return true; } @@ -109,7 +109,7 @@ public function verify(array $templates) * Get all names of template from provider * @return array|\Iterator */ - public function getList() + public function getList(string $extension = "tpl"): iterable { $c = $this->modx->newQuery('modTemplate'); $c->select('templatename'); diff --git a/core/components/pdotools/model/pdotools/_fenom.php b/core/components/pdotools/model/pdotools/_fenom.php index 3645aa83..cf198fc7 100644 --- a/core/components/pdotools/model/pdotools/_fenom.php +++ b/core/components/pdotools/model/pdotools/_fenom.php @@ -2,7 +2,6 @@ if (!class_exists('Fenom')) { require dirname(dirname(dirname(__FILE__))) . '/vendor/autoload.php'; - Fenom::registerAutoload(); } class FenomX extends Fenom From 79655e2686b4f64cb7eea46ca3fd71f6d5854a0a Mon Sep 17 00:00:00 2001 From: Ivan Klimchuk Date: Sun, 2 Apr 2023 16:43:14 +0300 Subject: [PATCH 3/5] chore: bump version --- _build/build.config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_build/build.config.php b/_build/build.config.php index 9c44073a..00b319d5 100644 --- a/_build/build.config.php +++ b/_build/build.config.php @@ -4,7 +4,7 @@ define('PKG_NAME', 'pdoTools'); define('PKG_NAME_LOWER', strtolower(PKG_NAME)); -define('PKG_VERSION', '2.13.2'); +define('PKG_VERSION', '2.14.0'); define('PKG_RELEASE', 'pl'); define('PKG_AUTO_INSTALL', false); From 640a0b208b319d57a8478e767612ee95ef2ee9d0 Mon Sep 17 00:00:00 2001 From: Ivan Klimchuk Date: Sun, 2 Apr 2023 16:46:23 +0300 Subject: [PATCH 4/5] fix: add compatibility in FenomX class --- core/components/pdotools/model/pdotools/_fenom.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/components/pdotools/model/pdotools/_fenom.php b/core/components/pdotools/model/pdotools/_fenom.php index cf198fc7..ab936653 100644 --- a/core/components/pdotools/model/pdotools/_fenom.php +++ b/core/components/pdotools/model/pdotools/_fenom.php @@ -72,7 +72,7 @@ public function __construct(pdoTools $pdoTools) * @throws LogicException * @return Fenom */ - public function setCompileDir($dir) + public function setCompileDir(string $dir): static { $dir = str_replace(MODX_CORE_PATH, '', $dir); $path = MODX_CORE_PATH; @@ -646,7 +646,7 @@ protected function _assertNoEval($pattern) * * @return Closure */ - protected function _loadModifier($name, $template) + protected function _loadModifier(string $name, Fenom\Template $template): ?string { $modx = $this->modx; $pdo = $this->pdoTools; From c75265678a2e8a74f0373748d20515bf826edb6d Mon Sep 17 00:00:00 2001 From: Ivan Klimchuk Date: Sun, 2 Apr 2023 16:48:22 +0300 Subject: [PATCH 5/5] update changelog --- core/components/pdotools/docs/changelog.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/components/pdotools/docs/changelog.txt b/core/components/pdotools/docs/changelog.txt index 62a08b7e..6d9944fd 100644 --- a/core/components/pdotools/docs/changelog.txt +++ b/core/components/pdotools/docs/changelog.txt @@ -1,5 +1,9 @@ Changelog for pdoTools. +2.14.0-pl (02.04.2023) +============== +- Fenom updated to 3.0 to be compatible with PHP 8. + 2.13.2-pl (02.09.2021) ============== - Fixed some snippets.