From 427d2adfe1503cc636c4df95909006c788e70882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Fri, 11 Nov 2022 23:48:25 +0100 Subject: [PATCH] Fix define check of class constant --- specs/const/const-declaration.php | 46 +++++++++++++++++++ .../NodeVisitor/StringScalarPrefixer.php | 17 ++++++- 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/specs/const/const-declaration.php b/specs/const/const-declaration.php index 08736856..aebf26d6 100644 --- a/specs/const/const-declaration.php +++ b/specs/const/const-declaration.php @@ -471,4 +471,50 @@ function isAnotherNewToken(int $token) : bool PHP, ], + + 'Define check of a global class constant' => <<<'PHP' + <<<'PHP' + value)) - || 1 !== native_preg_match(self::CLASS_LIKE_PATTERN, $string->value) + || ( + 1 !== native_preg_match(self::CLASS_LIKE_PATTERN, $string->value) + && 1 !== native_preg_match(self::CONSTANT_FETCH_PATTERN, $string->value) + ) ) { return $string; }