1--TEST-- 2Bug #73789 (Strange behavior of class constants in switch/case block) 3--FILE-- 4<?php 5class Lexer 6{ 7 const T_NONE = 1; 8 const T_STRING = 2; 9 const T_DOT = 8; 10 public function getType($value): int 11 { 12 $type = self::T_NONE; 13 switch (true) { 14 case ctype_alpha($value[0]): 15 $name = 'Lexer::T_' . strtoupper($value); 16 $type = constant($name); 17 if ($type > 100) { 18 return $type; 19 } 20 return self::T_STRING; 21 case $value === '.': 22 return self::T_DOT; 23 default: 24 } 25 return $type; 26 } 27} 28var_dump((new Lexer())->getType("dot")); 29--EXPECT-- 30int(2) 31