From 0a1f9abf3c8b743aeb5652f2dcb3cb1a58f14f11 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 2 Jun 2026 11:33:35 +0200 Subject: [PATCH] Define PHP 7.4 token constants for downgraded build --- bin/swiss-knife.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bin/swiss-knife.php b/bin/swiss-knife.php index f12534588..c1ba7951f 100755 --- a/bin/swiss-knife.php +++ b/bin/swiss-knife.php @@ -27,6 +27,19 @@ } } +// the released tool is downgraded to PHP 7.2, but the bundled nikic/php-parser +// references PHP 7.4 token constants directly - define them to avoid fatal errors +// (see https://github.com/easy-coding-standard/ecs/blob/main/bin/ecs.php for the same approach) +if (! defined('T_FN')) { + define('T_FN', 5025); +} +if (! defined('T_COALESCE_EQUAL')) { + define('T_COALESCE_EQUAL', 5030); +} +if (! defined('T_BAD_CHARACTER')) { + define('T_BAD_CHARACTER', 5035); +} + $containerFactory = new ContainerFactory(); $container = $containerFactory->create();