Skip to content

Commit

Permalink
Remove Str\split_args_switched
Browse files Browse the repository at this point in the history
Summary: See #3.

Reviewed By: fredemmott

Differential Revision: D5993148

fbshipit-source-id: 3f0bfdd65e2e80290beec84ee922ea6e2f7b58a2
  • Loading branch information
kmeht authored and facebook-github-bot committed Oct 6, 2017
1 parent 05235ad commit 9189d09
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions src/str/divide.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,38 +35,6 @@ function split(
string $string,
string $delimiter,
?int $limit = null,
): vec<string> {
return namespace\split_args_switched($string, $delimiter, $limit);
}

/**
* Q: What is this gross function?
* A: Currently, this API is inconsistent with the rest of the library, whose
* principle is that the "element being operated on" (in this case, the target
* string) should be the first element. This temporary function will be used
* to correct that inconsistency.
*
* Q: Why are you disrupting my workflow?
* A: We recognize that this will be disruptive in the short term and apologize
* for the inconvenience. However, it provides the benefit of predictablity
* for all future users of the HSL.
*
* Q: But why now?
* We are expecting to mark the HSL as 1.0 soon, so this is our only chance to
* fix this.
*
* Q: Okay, fine... what's the game plan?
* A: All uses of Str\split will be codemodded to Str\split_args_switched, and
* Str\split will be temporarily deprecated. After a short period, Str\split
* will be fixed, all callsites will be codemodded back, and this function will
* be removed.
*
* Task: T17219441
*/
function split_args_switched(
string $string,
string $delimiter,
?int $limit = null,
): vec<string> {
if ($delimiter === '') {
if ($limit === null || $limit >= \strlen($string)) {
Expand Down

0 comments on commit 9189d09

Please sign in to comment.