php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #67019 Class variable initialization scalar expressions
Submitted: 2014-04-04 08:16 UTC Modified: 2014-04-04 13:54 UTC
From: flip101 at gmail dot com Assigned: nikic (profile)
Status: Closed Package: *General Issues
PHP Version: 5.6.0alpha3 OS:
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: flip101 at gmail dot com
New email:
PHP Version: OS:

 

 [2014-04-04 08:16 UTC] 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;
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-04-04 13:54 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2014-04-04 13:54 UTC] 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 15:28 UTC] flip101 at gmail dot com
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 22 03:01:32 2024 UTC