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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC