#43456 [NEW]: forcing type of variable in class
| From: | kjarli at gmail dot com | Date: | Thu, 29 Nov 2007 16:55:05 +0000 |
| Subject: | #43456 [NEW]: forcing type of variable in class | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-120221@lists.php.net to get a copy of this message | ||
From: kjarli at gmail dot com
Operating system:
PHP version: 5.2.5
PHP Bug Type: Feature/Change Request
Bug description: forcing type of variable in class
Description:
------------
Why not adding something like this in classes:
public $array:Array;
private $bool:Bool = false;
protected $number:Number = 40;
var $string:String = 'a text';
This is like forcing a variable into a bool, array, number etc.
This should be pure for classes only.
Assigning an array value to like a :Number, will cause a notice error.
This is usefull for
1. Debugging
2. accessing public values
3. If you are working with more than 1 person, your class won't get messed
up.
4. if you use like :Number, and you insert '10', it can force it into a
number.
--
Edit bug report at http://bugs.php.net/?id=43456&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43456&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43456&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43456&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43456&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43456&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=43456&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43456&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43456&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43456&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43456&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43456&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=43456&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=43456&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43456&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43456&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43456&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43456&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43456&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43456&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43456&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43456&r=mysqlcfg