Req #67019 [Com]: Class variable initialization scalar expressions

From: Date: Fri, 04 Apr 2014 15:28:31 +0000
Subject: Req #67019 [Com]: Class variable initialization scalar expressions
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-185089@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67019&edit=1

 ID:                 67019
 Comment by:         flip101 at gmail dot com
 Reported by:        flip101 at gmail dot com
 Summary:            Class variable initialization scalar expressions
 Status:             Closed
 Type:               Feature/Change Request
 Package:            *General Issues
 PHP Version:        5.6.0alpha3
 Assigned To:        nikic
 Block user comment: N
 Private report:     N

 New Comment:

Oh sorry you are right, i didn't look closely to the RFC. Also i was told in ##php it was
"of course not possible". Excuse the confusion.


Previous Comments:
------------------------------------------------------------------------
[2014-04-04 13:54:24] nikic@php.net

Not sure what the request here is. Your code sample already works. The const_scalar_exprs RFC
applies to anything that uses a static scalar intializer, which includes properties.

------------------------------------------------------------------------
[2014-04-04 08:16:12] flip101 at gmail dot com

Description:
------------
Since the value for class initialization are of a fixed nature, the method for constant scalar
expressions could be used as well. As proposed here: https://wiki.php.net/rfc/const_scalar_exprs

Test script:
---------------
<?php
class TestClass {
  protected $testValue = 2 * 2;
}



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=67019&edit=1


Thread (3 messages)

« previous php.bugs (#185089) next »