php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #50724 returnIf command for functions and method
Submitted: 2010-01-11 23:06 UTC Modified: 2010-01-11 23:13 UTC
From: talat at imranmedia dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.3SVN-2010-01-11 (snap) OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: talat at imranmedia dot com
New email:
PHP Version: OS:

 

 [2010-01-11 23:06 UTC] talat at imranmedia dot com
Description:
------------
Very often when writing a method, there is a conditional block, say for security purposes, where a special return case is required.  The code would look something like this:

if($this->someCheck($foo))
{
   return $bar;
}
// continue method

It would be great if we could just write a line such as:

returnIf($condition,$return);
// continue method

This is a nice to have, but would improve code readability.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-11 23:13 UTC] johannes@php.net
This would add one token one would have to consider while reviewing code and not necessarily help in any way.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat Jan 29 02:03:33 2022 UTC