File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -4,9 +4,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).<Paste>
44
55## [ Unreleased]
66
7+ ## [ 0.2.2] - 2016-03-18
8+ ### Added
9+ - ` newInstance() `
10+
711## [ 0.2.1] - 2016-03-13
812### Added
9- - ` callStatic `
13+ - ` callStatic() `
1014
1115## [ 0.2.0] - 2016-02-07
1216### Added
Original file line number Diff line number Diff line change @@ -214,3 +214,30 @@ function ($value) {
214214 return strpos('Tom: My name is Tom', $value, 4);
215215}
216216```
217+
218+ #### T\newInstance(string $className, array $arguments = [ __ ] )
219+
220+ ``` php
221+ T\newInstance(Widget::class);
222+
223+ // Is equivalent to:
224+
225+ function ($value) {
226+ return new Widget($value);
227+ }
228+ ```
229+
230+ You can also provide a list of arguments using ` __ ` as the placeholder for where
231+ you want the value inserted:
232+
233+ ``` php
234+ use const TomPHP\Transform\__;
235+
236+ T\newInstance(Widget, ['first', __, 'last']);
237+
238+ // Is equivalent to:
239+
240+ function ($value) {
241+ return new Widget('first', $value, 'last');
242+ }
243+ ```
You can’t perform that action at this time.
0 commit comments