xp-framework/rfc — Issue #156: Constructor::newInstance()
Author: thekid
Created: 2011-10-17 16:01:22+00:00
State: closed
Labels: framework, implemented

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