thekid/rfc — Issue #156: RFC 0156: Constructor::newInstance()
Author: thekid
Created: 2011-10-09 15:28:09+00:00
State: open
Labels: implemented, rfc

Scope of Change
====
The method lang.reflect.Constructor::newInstance() will be changed no
longer to accept varargs.

Rationale
====
The method lang.XPClass::newInstance() accepts varargs, but there is no
way to pass an argument array to the constructor except for using
call_user_func_array().

Functionality
====

Old method
----

```php
newInstance();
$class->newInstance(6100);
$class->getConstructor()->newInstance();
$class->getConstructor()->newInstance(6100);
}
?>
```

New method
----

```php
newInstance();
$class->newInstance(6100);
$class->getConstructor()->newInstance();
$class->getConstructor()->newInstance(array(6100)); // !!!
}
?>
```

Security considerations
====
None.

Speed impact
====
Faster.

Dependencies
====
- BC break in lang.reflect.Constructor

Related documents
====
- http://xp-framework.net/rfc/contrib/rfc0156.diff
Implementing patch

Comments
====
n/a