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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
23 - 16 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 22:01:33 2024 UTC