Req #79669 [Opn->Fbk]: Nullable variables

From: Date: Wed, 03 Jun 2020 09:29:11 +0000
Subject: Req #79669 [Opn->Fbk]: Nullable variables
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227284@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79669&edit=1 ID: 79669 Updated by: danack@php.net Reported by: valentiny510 at gmail dot com Summary: Nullable variables -Status: Open +Status: Feedback Type: Feature/Change Request Package: Variables related Operating System: nix PHP Version: Next Major Version Block user comment: N Private report: N New Comment: I have no idea what you are saying. Please write clearly: i) The code that you are currently writing that you don't like. ii) a description of why that is a problem. I get that you want something to be shorter, but you haven't said what. Previous Comments: ------------------------------------------------------------------------ [2020-06-03 09:20:47] valentiny510 at gmail dot com Description: ------------ The coalescing operator is one of the best life (or write) savers, and still in some situations became a bit redundant, assuming $b is not set... $a = $b ?? null; meaning "if is null, null, else null" And we have to do this only to avoid the errors flooding the log... (yes, I know we can disable it with error_reporting, but that will also disable other errors that we may want to see) Another good thing is the nullable type, but sadly it only apply to... types So, my request is to extend the "nullable" to other... things, like variables for instance, and I think will be a great life saver Ex: $a = ?$b; Seeing the above assignment, probably will be better to create a new operator, =? Meaning of course, assign the right side if isset, otherwise null Thank you ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79669&edit=1

« previous php.bugs (#227284) next »