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();