From f9a936853521ae3b26676426398933750fd40cc1 Mon Sep 17 00:00:00 2001 From: mscherer Date: Wed, 26 Nov 2025 20:39:02 +0100 Subject: [PATCH 1/2] Add configurable command naming with underscore style MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add TwigView.useUnderscoreCommands config option - When true: registers `twig_view compile` (new style) - When false/unset: registers `twig-view compile` (deprecated) - Add config/app.example.php documenting available options - Add PHPUnit 12 support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- composer.json | 6 +++--- config/app.example.php | 31 +++++++++++++++++++++++++++++++ phpcs.xml | 3 +++ src/TwigViewPlugin.php | 8 +++++++- 4 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 config/app.example.php diff --git a/composer.json b/composer.json index 3e15dc2..3104720 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "cakephp/debug_kit": "^5.0", "michelf/php-markdown": "^1.9", "mikey179/vfsstream": "^1.6.10", - "phpunit/phpunit": "^10.5.5 || ^11.1.3" + "phpunit/phpunit": "^10.5.5 || ^11.1.3 || ^12.0" }, "conflict": { "wyrihaximus/twig-view": "*" @@ -50,8 +50,8 @@ } }, "scripts": { - "cs-check": "phpcs --colors --parallel=16 -p src/ tests/", - "cs-fix": "phpcbf --colors --parallel=16 -p src/ tests/", + "cs-check": "phpcs --colors --parallel=16 -p", + "cs-fix": "phpcbf --colors --parallel=16 -p", "phpstan": "tools/phpstan analyse", "stan": "@phpstan", "phpstan-baseline": "tools/phpstan --generate-baseline", diff --git a/config/app.example.php b/config/app.example.php new file mode 100644 index 0000000..b14c387 --- /dev/null +++ b/config/app.example.php @@ -0,0 +1,31 @@ + [ + /** + * Use underscore command names. + * + * When `true`, registers `twig_view compile` (with underscore). + * When `false` or not set, registers `twig-view compile` (deprecated, with hyphen). + * + * Upgrade path: + * 1. Update your scripts/CI to use `twig_view compile` + * 2. Set this to `true` + */ + 'useUnderscoreCommands' => true, + ], +]; diff --git a/phpcs.xml b/phpcs.xml index 708907e..f377cf4 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -1,4 +1,7 @@ + src/ + tests/ + diff --git a/src/TwigViewPlugin.php b/src/TwigViewPlugin.php index 98b1760..e40217f 100644 --- a/src/TwigViewPlugin.php +++ b/src/TwigViewPlugin.php @@ -20,6 +20,7 @@ use Cake\Console\CommandCollection; use Cake\Core\BasePlugin; +use Cake\Core\Configure; use Cake\TwigView\Command\CompileCommand; /** @@ -46,7 +47,12 @@ class TwigViewPlugin extends BasePlugin */ public function console(CommandCollection $commands): CommandCollection { - $commands->add('twig-view compile', CompileCommand::class); + if (Configure::read('TwigView.useUnderscoreCommands')) { + $commands->add('twig_view compile', CompileCommand::class); + } else { + // Deprecated: use `'TwigView.useUnderscoreCommands' => true` to switch to `twig_view compile` + $commands->add('twig-view compile', CompileCommand::class); + } return $commands; } From f606a6f070562da5fbeebb087e47ab966fc61020 Mon Sep 17 00:00:00 2001 From: mscherer Date: Wed, 26 Nov 2025 20:48:21 +0100 Subject: [PATCH 2/2] Add PHP min requirement explicitly. --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 3104720..56f97a7 100644 --- a/composer.json +++ b/composer.json @@ -22,6 +22,7 @@ "source": "https://github.com/cakephp/twig-view" }, "require": { + "php": ">=8.1", "cakephp/cakephp": "^5.0.0", "jasny/twig-extensions": "^1.3", "twig/markdown-extra": "^3.0",