rfc:class_properties_initialization

This is an old revision of the document!


Request for Comments: Class properties initialization

Introduction

The purpose of this feature is to provide more advanced way to initialize class properties using closures, objects, type hinting.

Why do we need it?

  • annotations

Proposal

It's possible that this feature would be one of the best use with proposals:

class Foo
{
    private $var1 = new Bar();
    private $var2 = Bar :: getInstance ();
 
    private $var3 = time ();
 
    private $var4 = function () { /* some callback ? */ }
 
    private $var5 = array ( 'foo' => function () { /* some callback ? */ } );
 
    private httpRequest $var6 = NULL;
}

Rejected initialization types

Changelog

2010-07-30 k.antczak Initial RFC creation.

rfc/class_properties_initialization.1280484856.txt.gz · Last modified: 2017/09/22 13:28 (external edit)