File tree Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -125,12 +125,11 @@ private function filterIndex(int $index): int|null
125
125
126
126
public function replace (int $ index , Item |ByteSequence |Token |bool |int |float |string |null $ element ): void
127
127
{
128
- $ offset = $ this ->filterIndex ($ index );
129
- if (null === $ offset || !$ this ->hasIndex ($ offset )) {
128
+ if (!$ this ->hasIndex ($ index )) {
130
129
throw InvalidOffset::dueToIndexNotFound ($ index );
131
130
}
132
131
133
- $ this ->elements [$ offset ] = self ::convertItem ($ element );
132
+ $ this ->elements [$ this -> filterIndex ( $ index ) ] = self ::convertItem ($ element );
134
133
}
135
134
136
135
public function remove (int ...$ indexes ): void
Original file line number Diff line number Diff line change @@ -125,12 +125,11 @@ public function insert(
125
125
126
126
public function replace (int $ index , InnerList |Item |ByteSequence |Token |bool |int |float |string $ element ): void
127
127
{
128
- $ offset = $ this ->filterIndex ($ index );
129
- if (null === $ offset || !$ this ->hasIndex ($ offset )) {
128
+ if (!$ this ->hasIndex ($ index )) {
130
129
throw InvalidOffset::dueToIndexNotFound ($ index );
131
130
}
132
131
133
- $ this ->elements [$ offset ] = self ::filterElement ($ element );
132
+ $ this ->elements [$ this -> filterIndex ( $ index ) ] = self ::filterElement ($ element );
134
133
}
135
134
136
135
public function remove (int ...$ indexes ): void
You can’t perform that action at this time.
0 commit comments