[php-src] Issue #9984: On the problems of enumeration comparison

From: Date: Tue, 22 Nov 2022 04:07:46 +0000
Subject: [php-src] Issue #9984: On the problems of enumeration comparison
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-242860@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/9984 Author: pinerge ### Description ### Code: ```php <?php declare(strict_types=1); enum Level { case Error; case Info; } var_dump(Level::Error instanceof Level); // true var_dump(Level::Error instanceof (Level::Info)); // true var_dump(Level::Error instanceof Level::Info); // Parse error: syntax error, unexpected identifier "Warning", expecting variable or "$" in enum-test.php on line 12 // PHP 8.1.12 (cli) (built: Oct 25 2022 18:20:48) (NTS Visual C++ 2019 x64) // Copyright (c) The PHP Group // Zend Engine v4.1.12, Copyright (c) Zend Technologies ``` ### Description: When the enumeration member is on the right side of instanceof, I must enclose the entire enumeration member, otherwise there will be parsing errors. I think this is redundant. ### PHP Version PHP 8.1.12 (cli) (built: Oct 25 2022 18:20:48) (NTS Visual C++ 2019 x64) ### Operating System Windows 10 Professional 22H2 19045.2251

« previous php.bugs (#242860) next »