@@ -16,7 +16,7 @@ public function it_can_be_instantiated_with_an_collection_of_item(): void
16
16
$ stringItem = Item::from ('helloWorld ' );
17
17
$ booleanItem = Item::from (true );
18
18
$ arrayParams = [$ stringItem , $ booleanItem ];
19
- $ instance = InnerList::from (...$ arrayParams )
19
+ $ instance = InnerList::fromMembers (...$ arrayParams )
20
20
->withParameters (Parameters::fromAssociative (['test ' => Item::from (42 )]));
21
21
22
22
self ::assertSame ($ stringItem , $ instance ->get (0 ));
@@ -31,7 +31,7 @@ public function it_can_add_or_remove_members(): void
31
31
{
32
32
$ stringItem = Item::from ('helloWorld ' );
33
33
$ booleanItem = Item::from (true );
34
- $ instance = InnerList::from ($ stringItem , $ booleanItem );
34
+ $ instance = InnerList::fromMembers ($ stringItem , $ booleanItem );
35
35
36
36
self ::assertCount (2 , $ instance );
37
37
self ::assertTrue ($ instance ->has (1 ));
@@ -61,7 +61,7 @@ public function it_can_add_or_remove_members(): void
61
61
#[Test]
62
62
public function it_can_unshift_insert_and_replace (): void
63
63
{
64
- $ container = InnerList::from ()
64
+ $ container = InnerList::fromMembers ()
65
65
->unshift ('42 ' )
66
66
->push (42 )
67
67
->insert (1 , 42.0 )
@@ -76,7 +76,7 @@ public function it_can_unshift_insert_and_replace(): void
76
76
#[Test]
77
77
public function it_returns_the_same_object_if_nothing_is_changed (): void
78
78
{
79
- $ container = InnerList::from (42 , 'forty-two ' );
79
+ $ container = InnerList::fromMembers (42 , 'forty-two ' );
80
80
81
81
$ sameContainer = $ container
82
82
->unshift ()
@@ -91,21 +91,21 @@ public function it_fails_to_replace_invalid_index(): void
91
91
{
92
92
$ this ->expectException (InvalidOffset::class);
93
93
94
- InnerList::from ()->replace (0 , ByteSequence::fromDecoded ('Hello World ' ));
94
+ InnerList::fromMembers ()->replace (0 , ByteSequence::fromDecoded ('Hello World ' ));
95
95
}
96
96
97
97
#[Test]
98
98
public function it_fails_to_insert_at_an_invalid_index (): void
99
99
{
100
100
$ this ->expectException (InvalidOffset::class);
101
101
102
- InnerList::from ()->insert (3 , ByteSequence::fromDecoded ('Hello World ' ));
102
+ InnerList::fromMembers ()->insert (3 , ByteSequence::fromDecoded ('Hello World ' ));
103
103
}
104
104
105
105
#[Test]
106
106
public function it_fails_to_return_an_member_with_invalid_index (): void
107
107
{
108
- $ instance = InnerList::from ();
108
+ $ instance = InnerList::fromMembers ();
109
109
110
110
self ::assertFalse ($ instance ->has (3 ));
111
111
@@ -117,7 +117,7 @@ public function it_fails_to_return_an_member_with_invalid_index(): void
117
117
#[Test]
118
118
public function it_can_access_its_parameter_values (): void
119
119
{
120
- $ instance = InnerList::from ( false )-> addParameter ( 'foo ' , 'bar ' );
120
+ $ instance = InnerList::fromAssociativeParameters ([ 'foo ' => 'bar ' ], false );
121
121
122
122
self ::assertSame ('bar ' , $ instance ->parameters ()->get ('foo ' )->value ());
123
123
self ::assertSame ('bar ' , $ instance ->parameter ('foo ' ));
@@ -128,7 +128,7 @@ public function it_fails_to_access_unknown_parameter_values(): void
128
128
{
129
129
$ this ->expectException (StructuredFieldError::class);
130
130
131
- InnerList::from (false )->parameters ()->get ('bar ' )->value ();
131
+ InnerList::fromMembers (false )->parameters ()->get ('bar ' )->value ();
132
132
}
133
133
134
134
#[Test]
@@ -159,29 +159,29 @@ public function it_fails_to_insert_unknown_index_via_the_array_access_interface(
159
159
{
160
160
$ this ->expectException (StructuredFieldError::class);
161
161
162
- InnerList::from ()->insert (0 , Item::from (42.0 ));
162
+ InnerList::fromMembers ()->insert (0 , Item::from (42.0 ));
163
163
}
164
164
165
165
#[Test]
166
166
public function it_returns_the_same_object_if_no_member_is_removed (): void
167
167
{
168
- self ::assertCount (0 , InnerList::from ()->remove (0 ));
168
+ self ::assertCount (0 , InnerList::fromMembers ()->remove (0 ));
169
169
}
170
170
171
171
#[Test]
172
172
public function it_fails_to_fetch_an_value_using_an_integer (): void
173
173
{
174
174
$ this ->expectException (InvalidOffset::class);
175
175
176
- InnerList::from ()->get ('zero ' );
176
+ InnerList::fromMembers ()->get ('zero ' );
177
177
}
178
178
179
179
#[Test]
180
180
public function it_can_access_the_item_value (): void
181
181
{
182
182
$ token = Token::fromString ('token ' );
183
183
$ input = ['foobar ' , 0 , false , $ token ];
184
- $ structuredField = InnerList::from (...$ input );
184
+ $ structuredField = InnerList::fromMembers (...$ input );
185
185
186
186
self ::assertFalse ($ structuredField ->get (2 )->value ());
187
187
self ::assertEquals ($ token , $ structuredField ->get (-1 )->value ());
@@ -190,7 +190,7 @@ public function it_can_access_the_item_value(): void
190
190
#[Test]
191
191
public function it_can_create_via_with_parameters_method_a_new_object (): void
192
192
{
193
- $ instance1 = InnerList::from ( Token::fromString ('babayaga ' ), ' a ' , true )-> addParameter ( 'a ' , true );
193
+ $ instance1 = InnerList::fromPairParameters ([[ ' a ' , true ]], Token::fromString ('babayaga ' ), 'a ' , true );
194
194
$ instance2 = $ instance1 ->withParameters (Parameters::fromAssociative (['a ' => true ]));
195
195
$ instance3 = $ instance1 ->withParameters (Parameters::fromAssociative (['a ' => false ]));
196
196
@@ -202,7 +202,7 @@ public function it_can_create_via_with_parameters_method_a_new_object(): void
202
202
#[Test]
203
203
public function it_can_create_via_parameters_access_methods_a_new_object (): void
204
204
{
205
- $ instance1 = InnerList::from (Token::fromString ('babayaga ' ), 'a ' , true )->withParameters (Parameters::fromAssociative (['a ' => true ]));
205
+ $ instance1 = InnerList::fromMembers (Token::fromString ('babayaga ' ), 'a ' , true )->withParameters (Parameters::fromAssociative (['a ' => true ]));
206
206
$ instance2 = $ instance1 ->appendParameter ('a ' , true );
207
207
$ instance7 = $ instance1 ->addParameter ('a ' , true );
208
208
$ instance3 = $ instance1 ->prependParameter ('a ' , false );
@@ -224,7 +224,7 @@ public function it_can_create_via_parameters_access_methods_a_new_object(): void
224
224
#[Test]
225
225
public function it_implements_the_array_access_interface (): void
226
226
{
227
- $ structuredField = InnerList::from ('foobar ' , 'foobar ' , 'zero ' , 0 );
227
+ $ structuredField = InnerList::fromMembers ('foobar ' , 'foobar ' , 'zero ' , 0 );
228
228
229
229
self ::assertInstanceOf (Item::class, $ structuredField ->get (0 ));
230
230
self ::assertInstanceOf (Item::class, $ structuredField [0 ]);
@@ -237,22 +237,22 @@ public function it_forbids_removing_members_using_the_array_access_interface():
237
237
{
238
238
$ this ->expectException (LogicException::class);
239
239
240
- unset(InnerList::from ('foobar ' , 'foobar ' , 'zero ' , 0 )[0 ]);
240
+ unset(InnerList::fromMembers ('foobar ' , 'foobar ' , 'zero ' , 0 )[0 ]);
241
241
}
242
242
243
243
#[Test]
244
244
public function it_forbids_adding_members_using_the_array_access_interface (): void
245
245
{
246
246
$ this ->expectException (LogicException::class);
247
247
248
- InnerList::from ('foobar ' , 'foobar ' , 'zero ' , 0 )[0 ] = Item::from (false );
248
+ InnerList::fromMembers ('foobar ' , 'foobar ' , 'zero ' , 0 )[0 ] = Item::from (false );
249
249
}
250
250
251
251
252
252
#[Test]
253
253
public function it_can_returns_the_container_member_keys (): void
254
254
{
255
- $ instance = InnerList::from ();
255
+ $ instance = InnerList::fromMembers ();
256
256
257
257
self ::assertSame ([], $ instance ->keys ());
258
258
@@ -261,7 +261,7 @@ public function it_can_returns_the_container_member_keys(): void
261
261
262
262
self ::assertSame ([0 , 1 ], $ newInstance ->keys ());
263
263
264
- $ container = InnerList::from ()
264
+ $ container = InnerList::fromMembers ()
265
265
->unshift ('42 ' )
266
266
->push (42 )
267
267
->insert (1 , 42.0 )
0 commit comments