Skip to content

Commit

Permalink
remove php-ds
Browse files Browse the repository at this point in the history
  • Loading branch information
danny50610 committed Aug 19, 2023
1 parent 37c1d23 commit ed12300
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
}
],
"require": {
"php": "^8.1",
"ext-ds": "*"
"php": "^8.1"
},
"require-dev": {
"phpunit/phpunit": "^10"
Expand Down
5 changes: 2 additions & 3 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions src/Encoding.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ protected function bytePairEncode(string $piece, $ranks): array
// This is a vector of (start, rank).
// The rank is of the byte pair starting at position start.
// The rank of the last item in the vector is not a valid value.
$parts = new \Ds\Vector();
$parts->allocate(strlen($piece) + 1);
$parts = [];
for ($i = 0; $i < strlen($piece) + 1; $i++) {
$parts[] = [$i, PHP_INT_MAX];
}
Expand Down Expand Up @@ -104,7 +103,7 @@ protected function bytePairEncode(string $piece, $ranks): array
$parts[$i - 1][1] = is_null($newValue) ? PHP_INT_MAX : $newValue;
}

$parts->remove($i + 1);
array_splice($parts, $i + 1, 1, null);
} else {
break;
}
Expand Down

0 comments on commit ed12300

Please sign in to comment.