Ticket #162 (new enhancement)

Opened 3 months ago

Static constructor

Reported by: mikey Assigned to: mikey
Priority: major Milestone: aquamarine
Component: core Version: SVN-trunk
Keywords: Cc:

Description

In our base class net::stubbles::lang::stubBaseObject there should be a static method newInstance() which will return an instance of the class on which it was requested using late static binding:

$example = Example::newInstance();
// $example now contains an instance of class Example

Each argument passed to the newInstance() method will be passed to the constructor.

This allows method chaining also on construction:

$firstLine = stubFileInputStream::newInstance('file.txt')->readLine();