Bug #79989 [Opn->Nab]: new `match` keyword is inconsistant in syntax errors

From: Date: Tue, 18 Aug 2020 10:32:26 +0000
Subject: Bug #79989 [Opn->Nab]: new `match` keyword is inconsistant in syntax errors
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228635@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79989&edit=1 ID: 79989 Updated by: cmb@php.net Reported by: call dot user dot func at gmail dot com Summary: new match keyword is inconsistant in syntax errors -Status: Open +Status: Not a bug Type: Bug -Package: *General Issues +Package: Scripting Engine problem Operating System: W10 PHP Version: 8.0.0beta1 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: The behavioral change of the namespace declaration is due to RFC: Treat namespaced names as single token[1], which only has been implemented for 8.0.0beta1, and is mentioned in UPGRADING[2]. [1] <https://wiki.php.net/rfc/namespaced_names_as_token> [2] <https://github.com/php/php-src/blob/php-8.0.0beta1/UPGRADING#L207-L210>> Previous Comments: ------------------------------------------------------------------------ [2020-08-18 10:02:55] call dot user dot func at gmail dot com Description: ------------ Stated in this RFC: https://wiki.php.net/rfc/match_expression_v2#backward_incompatible_changes we have this new keyword match which now result in syntax errors when used as a namespaces, class names, function names, global constants. Well, this behaviour is not consistant with the RFC and also inconsistent between the alpha3 and all other pre-release versions of php8. My tests are in the attached test scripts. Greetz Roland Test script: --------------- <?php define("match", 1); // no error in php8.0.0beta1 class Match{} // error in php8.0.0beta1 function match(){} // error in php8.0.0beta1 namespace match{} // only error in php8.0.0alpha3 namespace Foo\Bar\Match; // only error in php8.0.0alpha3 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79989&edit=1

« previous php.bugs (#228635) next »