From cde3efb1a4e9a602b9b1be1f9ea25898583fc844 Mon Sep 17 00:00:00 2001 From: Fred Emmott Date: Thu, 17 Aug 2017 13:13:13 -0700 Subject: [PATCH] use `use namespace` Summary: No change to the commits, just a new PR Closes https://github.com/hhvm/hsl/pull/23 Reviewed By: kmeht Differential Revision: D5651178 Pulled By: kmeht fbshipit-source-id: 0461b6307a95cd34836bcc97fbb9005bccad24c1 --- bin/generate-docs.php | 22 +++++++-------- src/dict/combine.php | 2 +- src/dict/introspect.php | 2 +- src/dict/order.php | 2 +- src/keyset/introspect.php | 2 +- src/math/compute.php | 3 +-- src/math/containers.php | 4 +-- src/vec/order.php | 5 +--- src/vec/select.php | 3 +-- tests/c/CIntrospectTest.php | 2 +- tests/c/CReduceTest.php | 2 +- tests/c/CSelectTest.php | 2 +- tests/dict/DictCombineTest.php | 6 ++--- tests/dict/DictDivideTest.php | 6 ++--- tests/dict/DictIntrospectTest.php | 4 +-- tests/dict/DictOrderTest.php | 10 +++---- tests/dict/DictSelectTest.php | 37 +++++++++++++------------ tests/dict/DictTransformTest.php | 31 +++++++++++---------- tests/keyset/KeysetCombineTest.php | 4 +-- tests/keyset/KeysetDivideTest.php | 4 +-- tests/keyset/KeysetIntrospectTest.php | 4 +-- tests/keyset/KeysetOrderTest.php | 4 +-- tests/keyset/KeysetSelectTest.php | 28 +++++++++---------- tests/keyset/KeysetTransformTest.php | 10 +++---- tests/math/MathComputeTest.php | 2 +- tests/math/MathContainersTest.php | 2 +- tests/str/StrCombineTest.php | 2 +- tests/str/StrDivideTest.php | 2 +- tests/str/StrIntrospectTest.php | 2 +- tests/str/StrSelectTest.php | 2 +- tests/str/StrTransformTest.php | 2 +- tests/vec/VecCombineTest.php | 4 +-- tests/vec/VecDivideTest.php | 4 +-- tests/vec/VecOrderTest.php | 15 +++++------ tests/vec/VecSelectTest.php | 39 +++++++++++++-------------- tests/vec/VecTransformTest.php | 12 ++++----- 36 files changed, 137 insertions(+), 150 deletions(-) diff --git a/bin/generate-docs.php b/bin/generate-docs.php index f7b441dd..23d2ae50 100644 --- a/bin/generate-docs.php +++ b/bin/generate-docs.php @@ -18,9 +18,7 @@ ScannedTypehint, TreeParser }; -use HH\Lib\Dict as DictHSL; -use HH\Lib\Vec as VecHSL; -use HH\Lib\{C, Str}; +use namespace HH\Lib\{C, Dict, Str, Vec}; require_once(__DIR__.'/../vendor/autoload.php'); require_once(__DIR__.'/../vendor/hh_autoload.php'); @@ -36,9 +34,9 @@ public function createInDirectory($path): void { $namespaces_funcs = TreeParser::FromPath(__DIR__.'/../src/') ->getFunctions() - |>DictHSL\group_by($$, $f ==> $f->getNamespaceName()) - |>DictHSL\sort_by_key($$) - |>DictHSL\filter_keys( + |>Dict\group_by($$, $f ==> $f->getNamespaceName()) + |>Dict\sort_by_key($$) + |>Dict\filter_keys( $$, $ns ==> $ns !== '' && $ns !== "HH\\Lib\\_Private", ); @@ -53,8 +51,8 @@ public function createInDirectory($path): void { } $namespaces_funcs - |>VecHSL\keys($$) - |>VecHSL\map( + |>Vec\keys($$) + |>Vec\map( $$, $ns ==> sprintf( " - [%s](%s)", @@ -74,7 +72,7 @@ private function getMarkdownForNamespace( string $ns, vec $funcs, ): string { - $funcs = VecHSL\sort_by($funcs, $f ==> $f->getShortName()); + $funcs = Vec\sort_by($funcs, $f ==> $f->getShortName()); $short_ns = Str\strip_prefix($ns, "HH\\Lib\\"); $out = sprintf("# %s\n\n", $ns); @@ -159,7 +157,7 @@ private function renderGenerics( return null; } - $parts = VecHSL\map($g, $g ==> $this->renderGeneric($g)); + $parts = Vec\map($g, $g ==> $this->renderGeneric($g)); if ($multiline) { return "<\n ".Str\join(",\n ", $parts)."\n>"; @@ -195,7 +193,7 @@ private function renderParameters( if (C\is_empty($f->getParameters())) { return '()'; } - $parts = VecHSL\map($f->getParameters(), $p ==> $this->renderParameter($p)); + $parts = Vec\map($f->getParameters(), $p ==> $this->renderParameter($p)); if ($multiline_parameters) { $trailing_comma = Str\contains(C\lastx($parts), '...') ? '' : ','; return "(\n ".Str\join(",\n ", $parts).$trailing_comma."\n)"; @@ -253,7 +251,7 @@ private function renderDocComment(ScannedFunction $f): ?string { |>Str\strip_suffix($$, '*/') |>Str\trim($$) |>Str\split("\n", $$) - |>VecHSL\map($$, $s ==> Str\trim(Str\strip_prefix(Str\trim($s), '*'))) + |>Vec\map($$, $s ==> Str\trim(Str\strip_prefix(Str\trim($s), '*'))) |>Str\join("\n", $$) |>$$."\n"; } diff --git a/src/dict/combine.php b/src/dict/combine.php index 6caf93fd..20660573 100644 --- a/src/dict/combine.php +++ b/src/dict/combine.php @@ -11,7 +11,7 @@ namespace HH\Lib\Dict; -use \HH\Lib\C; +use namespace \HH\Lib\C; /** * Returns a new dict where each element in `$keys` maps to the diff --git a/src/dict/introspect.php b/src/dict/introspect.php index 0610eb68..8220aa45 100644 --- a/src/dict/introspect.php +++ b/src/dict/introspect.php @@ -11,7 +11,7 @@ namespace HH\Lib\Dict; -use \HH\Lib\C; +use namespace \HH\Lib\C; /** * Returns whether the two given dicts have the same entries, using strict diff --git a/src/dict/order.php b/src/dict/order.php index 977dbdfb..a7df0ff1 100644 --- a/src/dict/order.php +++ b/src/dict/order.php @@ -11,7 +11,7 @@ namespace HH\Lib\Dict; -use \HH\Lib\Vec; +use namespace \HH\Lib\Vec; /** * Returns a new dict with the original key/value pairs in reversed iteration diff --git a/src/keyset/introspect.php b/src/keyset/introspect.php index dc6418fa..868420d1 100644 --- a/src/keyset/introspect.php +++ b/src/keyset/introspect.php @@ -11,7 +11,7 @@ namespace HH\Lib\Keyset; -use \HH\Lib\C; +use namespace \HH\Lib\C; /** * Returns whether the two given keysets have the same elements, using strict diff --git a/src/math/compute.php b/src/math/compute.php index a81d60cf..694bc731 100644 --- a/src/math/compute.php +++ b/src/math/compute.php @@ -10,8 +10,7 @@ */ namespace HH\Lib\Math; -use HH\Lib\C; -use HH\Lib\Str; +use namespace HH\Lib\{C, Str}; use const HH\Lib\_Private\ALPHABET_ALPHANUMERIC; /** diff --git a/src/math/containers.php b/src/math/containers.php index cfab40ec..acc6f69a 100644 --- a/src/math/containers.php +++ b/src/math/containers.php @@ -10,9 +10,7 @@ */ namespace HH\Lib\Math; -use HH\Lib\C; -use HH\Lib\Math; -use HH\Lib\Vec; +use namespace HH\Lib\{C, Math, Vec}; /** * Returns the largest of all input numbers. diff --git a/src/vec/order.php b/src/vec/order.php index dbe678f9..b97c9692 100644 --- a/src/vec/order.php +++ b/src/vec/order.php @@ -11,10 +11,7 @@ namespace HH\Lib\Vec; -use \HH\Lib\C; -use \HH\Lib\Dict; -use \HH\Lib\Math; -use \HH\Lib\Str; +use namespace \HH\Lib\{C, Dict, Math, Str}; /** * Returns a new vec containing the range of numbers from `$start` to `$end` diff --git a/src/vec/select.php b/src/vec/select.php index 1c65f068..d6678333 100644 --- a/src/vec/select.php +++ b/src/vec/select.php @@ -11,8 +11,7 @@ namespace HH\Lib\Vec; -use \HH\Lib\Dict; -use \HH\Lib\Keyset; +use namespace \HH\Lib\{Dict, Keyset}; /** * Returns a new vec containing only the elements of the first Traversable that diff --git a/tests/c/CIntrospectTest.php b/tests/c/CIntrospectTest.php index 2f53c271..d4d65419 100644 --- a/tests/c/CIntrospectTest.php +++ b/tests/c/CIntrospectTest.php @@ -9,7 +9,7 @@ * */ -use \HH\Lib\C as C; +use namespace \HH\Lib\C; use function \Facebook\FBExpect\expect; /** diff --git a/tests/c/CReduceTest.php b/tests/c/CReduceTest.php index 265b14e9..fe861e91 100644 --- a/tests/c/CReduceTest.php +++ b/tests/c/CReduceTest.php @@ -9,7 +9,7 @@ * */ -use \HH\Lib\C as C; +use namespace \HH\Lib\C; use function \Facebook\FBExpect\expect; /** diff --git a/tests/c/CSelectTest.php b/tests/c/CSelectTest.php index 48eeaeed..086b5e46 100644 --- a/tests/c/CSelectTest.php +++ b/tests/c/CSelectTest.php @@ -9,7 +9,7 @@ * */ -use \HH\Lib\C as C; +use namespace \HH\Lib\C; use function \Facebook\FBExpect\expect; // @oss-disable: use InvariantViolationException as InvariantException; diff --git a/tests/dict/DictCombineTest.php b/tests/dict/DictCombineTest.php index 83b3ef2a..e59d4be9 100644 --- a/tests/dict/DictCombineTest.php +++ b/tests/dict/DictCombineTest.php @@ -9,7 +9,7 @@ * */ -use \HH\Lib\Dict as DictHSL; +use namespace \HH\Lib\Dict; use function \Facebook\FBExpect\expect; /** @@ -61,7 +61,7 @@ public function testAssociate( Traversable $values, dict $expected, ): void { - expect(DictHSL\associate($keys, $values))->toBeSame($expected); + expect(Dict\associate($keys, $values))->toBeSame($expected); } public static function provideTestMerge(): array { @@ -124,6 +124,6 @@ public function testMerge( Container> $traversables, dict $expected, ): void { - expect(DictHSL\merge(...$traversables))->toBeSame($expected); + expect(Dict\merge(...$traversables))->toBeSame($expected); } } diff --git a/tests/dict/DictDivideTest.php b/tests/dict/DictDivideTest.php index ec0eca23..bb501603 100644 --- a/tests/dict/DictDivideTest.php +++ b/tests/dict/DictDivideTest.php @@ -9,7 +9,7 @@ * */ -use \HH\Lib\Dict as DictHSL; +use namespace \HH\Lib\Dict; use function \Facebook\FBExpect\expect; /** @@ -113,7 +113,7 @@ public function testPartition( (function(Tv): bool) $predicate, (dict, dict) $expected, ): void { - expect(DictHSL\partition($traversable, $predicate))->toBeSame($expected); + expect(Dict\partition($traversable, $predicate))->toBeSame($expected); } /** @dataProvider providePartitionWithKey */ @@ -122,6 +122,6 @@ public function testPartitionWithKey( (function(Tk, Tv): bool) $predicate, (dict, dict) $expected, ): void { - expect(DictHSL\partition_with_key($traversable, $predicate))->toBeSame($expected); + expect(Dict\partition_with_key($traversable, $predicate))->toBeSame($expected); } } diff --git a/tests/dict/DictIntrospectTest.php b/tests/dict/DictIntrospectTest.php index 13901a19..87edfbbe 100644 --- a/tests/dict/DictIntrospectTest.php +++ b/tests/dict/DictIntrospectTest.php @@ -9,7 +9,7 @@ * */ -use \HH\Lib\Dict as DictHSL; +use namespace \HH\Lib\Dict; use function \Facebook\FBExpect\expect; /** @@ -58,6 +58,6 @@ public function testEqual( dict $dict2, bool $expected, ): void { - expect(DictHSL\equal($dict1, $dict2))->toBeSame($expected); + expect(Dict\equal($dict1, $dict2))->toBeSame($expected); } } diff --git a/tests/dict/DictOrderTest.php b/tests/dict/DictOrderTest.php index 41a3b71e..c5ff6d43 100644 --- a/tests/dict/DictOrderTest.php +++ b/tests/dict/DictOrderTest.php @@ -9,7 +9,7 @@ * */ -use \HH\Lib\Dict as DictHSL; +use namespace \HH\Lib\Dict; use function \Facebook\FBExpect\expect; /** @@ -55,7 +55,7 @@ public function testReverse( KeyedTraversable $traversable, dict $expected, ): void { - expect(DictHSL\reverse($traversable))->toBeSame($expected); + expect(Dict\reverse($traversable))->toBeSame($expected); } public static function provideTestSort(): array { @@ -129,7 +129,7 @@ public function testSort( ?(function(Tv, Tv): int) $value_comparator, dict $expected, ): void { - expect(DictHSL\sort($traversable, $value_comparator))->toBeSame($expected); + expect(Dict\sort($traversable, $value_comparator))->toBeSame($expected); } public static function provideTestSortBy(): array { @@ -174,7 +174,7 @@ public function testSortBy( ?(function(Ts, Ts): int) $scalar_comparator, dict $expected, ): void { - expect(DictHSL\sort_by($traversable, $scalar_func, $scalar_comparator)) + expect(Dict\sort_by($traversable, $scalar_func, $scalar_comparator)) ->toBeSame($expected); } @@ -218,7 +218,7 @@ public function testSortByKey( ?(function(Tk, Tk): int) $key_comparator, dict $expected, ): void { - expect(DictHSL\sort_by_key($traversable, $key_comparator)) + expect(Dict\sort_by_key($traversable, $key_comparator)) ->toBeSame($expected); } } diff --git a/tests/dict/DictSelectTest.php b/tests/dict/DictSelectTest.php index 1b4ac0ff..6650fa93 100644 --- a/tests/dict/DictSelectTest.php +++ b/tests/dict/DictSelectTest.php @@ -9,8 +9,7 @@ * */ -use \HH\Lib\Dict as DictHSL; -use \HH\Lib\Str; +use namespace \HH\Lib\{Dict, Str}; use function \Facebook\FBExpect\expect; /** @@ -57,7 +56,7 @@ public function testDiffByKey( Container> $rest, dict $expected, ): void { - expect(DictHSL\diff_by_key($first, $second, ...$rest))->toBeSame($expected); + expect(Dict\diff_by_key($first, $second, ...$rest))->toBeSame($expected); } public static function provideDrop(): array { @@ -109,7 +108,7 @@ public function testDrop( int $n, dict $expected, ): void { - expect(DictHSL\drop($traversable, $n))->toBeSame($expected); + expect(Dict\drop($traversable, $n))->toBeSame($expected); } public static function provideTestFilter(): array { @@ -158,7 +157,7 @@ public function testFilter( (function(Tv): bool) $value_predicate, dict $expected, ): void { - expect(DictHSL\filter($traversable, $value_predicate))->toBeSame($expected); + expect(Dict\filter($traversable, $value_predicate))->toBeSame($expected); } public static function provideTestFilterWithKey(): array { @@ -212,11 +211,11 @@ public function testFilterWithKey( (function(Tk, Tv): bool) $predicate, dict $expected, ): void { - expect(DictHSL\filter_with_key($traversable, $predicate))->toBeSame($expected); + expect(Dict\filter_with_key($traversable, $predicate))->toBeSame($expected); } public function testFilterWithoutPredicate(): void { - expect(DictHSL\filter(array( + expect(Dict\filter(array( 0 => 0, 3 => 3, 2 => null, @@ -265,12 +264,12 @@ public function testFilterKeys( (function(Tk): bool) $key_predicate, dict $expected, ): void { - expect(DictHSL\filter_keys($traversable, $key_predicate)) + expect(Dict\filter_keys($traversable, $key_predicate)) ->toBeSame($expected); } public function testFilterKeysWithoutPredicate(): void { - expect(DictHSL\filter_keys(dict[ + expect(Dict\filter_keys(dict[ '' => 1, '0' => 2, 0 => 3, @@ -334,7 +333,7 @@ public function testFilterNulls( KeyedTraversable $traversable, dict $expected, ): void { - expect(DictHSL\filter_nulls($traversable))->toBeSame($expected); + expect(Dict\filter_nulls($traversable))->toBeSame($expected); } public function testGenFilter(): void { @@ -377,7 +376,7 @@ public function testSelectKeys( Traversable $keys, dict $expected, ): void { - expect(DictHSL\select_keys($container, $keys))->toBeSame($expected); + expect(Dict\select_keys($container, $keys))->toBeSame($expected); } public static function provideTestSlice(): array { @@ -428,7 +427,7 @@ public function testSlice( ?int $length, dict $expected, ): void { - expect(DictHSL\slice($traversable, $offset, $length))->toBeSame($expected); + expect(Dict\slice($traversable, $offset, $length))->toBeSame($expected); } public static function provideTake(): array { @@ -483,15 +482,15 @@ public function testTake( int $n, dict $expected, ): void { - expect(DictHSL\take($traversable, $n))->toBeSame($expected); + expect(Dict\take($traversable, $n))->toBeSame($expected); } public function testTakeIter(): void { $iter = HackLibTestTraversables::getKeyedIterator(range(0, 4)); - expect(DictHSL\take($iter, 2))->toBeSame(dict[0=>0, 1=>1]); - expect(DictHSL\take($iter, 0))->toBeSame(dict[]); - expect(DictHSL\take($iter, 2))->toBeSame(dict[2=>2, 3=>3]); - expect(DictHSL\take($iter, 2))->toBeSame(dict[4=>4]); + expect(Dict\take($iter, 2))->toBeSame(dict[0=>0, 1=>1]); + expect(Dict\take($iter, 0))->toBeSame(dict[]); + expect(Dict\take($iter, 2))->toBeSame(dict[2=>2, 3=>3]); + expect(Dict\take($iter, 2))->toBeSame(dict[4=>4]); } public static function provideTestUnique(): array { @@ -518,7 +517,7 @@ public function testUnique( KeyedTraversable $traversable, dict $expected, ): void { - expect(DictHSL\unique($traversable))->toBeSame($expected); + expect(Dict\unique($traversable))->toBeSame($expected); } public static function provideTestUniqueBy(): array { @@ -545,6 +544,6 @@ public function testUniqueBy( (function(Tv): Ts) $scalar_func, dict $expected, ): void { - expect(DictHSL\unique_by($container, $scalar_func))->toBeSame($expected); + expect(Dict\unique_by($container, $scalar_func))->toBeSame($expected); } } diff --git a/tests/dict/DictTransformTest.php b/tests/dict/DictTransformTest.php index ee139945..a9a3fafa 100644 --- a/tests/dict/DictTransformTest.php +++ b/tests/dict/DictTransformTest.php @@ -9,8 +9,7 @@ * */ -use \HH\Lib\Dict as DictHSL; -use \HH\Lib\Str; +use namespace \HH\Lib\{Dict, Str}; use function \Facebook\FBExpect\expect; /** @@ -61,7 +60,7 @@ public function testChunk( int $size, vec> $expected, ): void { - expect(DictHSL\chunk($traversable, $size))->toBeSame($expected); + expect(Dict\chunk($traversable, $size))->toBeSame($expected); } public static function provideTestCountValues(): array { @@ -96,7 +95,7 @@ public function testCountValues( Traversable $values, dict $expected, ): void { - expect(DictHSL\count_values($values))->toBeSame($expected); + expect(Dict\count_values($values))->toBeSame($expected); } public static function provideTestFillKeys(): array { @@ -134,7 +133,7 @@ public function testFillKeys( Tv $value, dict $expected, ): void { - expect(DictHSL\fill_keys($keys, $value))->toBeSame($expected); + expect(Dict\fill_keys($keys, $value))->toBeSame($expected); } public static function provideTestFlip(): array { @@ -174,7 +173,7 @@ public function testFlip( KeyedTraversable $traversable, dict $expected, ): void { - expect(DictHSL\flip($traversable))->toBeSame($expected); + expect(Dict\flip($traversable))->toBeSame($expected); } public static function provideTestFromKeys(): array { @@ -216,7 +215,7 @@ public function testFromKeys( (function(Tk): Tv) $value_func, dict $expected, ): void { - expect(DictHSL\from_keys($keys, $value_func))->toBeSame($expected); + expect(Dict\from_keys($keys, $value_func))->toBeSame($expected); } public static function provideTestFromEntries(): array { @@ -265,7 +264,7 @@ public function testFromEntries( Traversable<(Tk, Tv)> $traversable, dict $expected, ): void { - expect(DictHSL\from_entries($traversable))->toBeSame($expected); + expect(Dict\from_entries($traversable))->toBeSame($expected); } public static function provideTestFromValues(): array { @@ -307,7 +306,7 @@ public function testFromValues( (function(Tv): Tk) $key_func, dict $expected, ): void { - expect(DictHSL\from_values($values, $key_func))->toBeSame($expected); + expect(Dict\from_values($values, $key_func))->toBeSame($expected); } public static function provideTestGroupBy(): array { @@ -342,7 +341,7 @@ public function testGroupBy( (function(Tv): ?Tk) $key_func, dict> $expected, ): void { - expect(DictHSL\group_by($values, $key_func))->toBeSame($expected); + expect(Dict\group_by($values, $key_func))->toBeSame($expected); } public static function provideTestMap(): array { @@ -416,12 +415,12 @@ public function testMap( (function (Tv1): Tv2) $func, dict $expected, ): void { - expect(DictHSL\map($traversable, $func))->toBeSame($expected); + expect(Dict\map($traversable, $func))->toBeSame($expected); if ($traversable instanceof KeyedContainer) { // Note: this test might fail because of key-coercion, // but at the time of writing none of the cases in the // data-provider should experience this coercion. - expect(DictHSL\map($traversable, $func))->toBeSame( + expect(Dict\map($traversable, $func))->toBeSame( dict(array_map($func, $traversable)), ); } @@ -479,7 +478,7 @@ public function testMapKeys( (function(Tk1): Tk2) $key_func, dict $expected, ): void { - expect(DictHSL\map_keys($traversable, $key_func))->toBeSame($expected); + expect(Dict\map_keys($traversable, $key_func))->toBeSame($expected); } public static function provideTestMapWithKey(): array { @@ -519,7 +518,7 @@ public function testMapWithKey( (function(Tk, Tv1): Tv2) $value_func, dict $expected, ): void { - expect(DictHSL\map_with_key($traversable, $value_func))->toBeSame($expected); + expect(Dict\map_with_key($traversable, $value_func))->toBeSame($expected); } public static function provideTestPull(): array { @@ -557,7 +556,7 @@ public function testPull( (function(Tv1): Tk) $key_func, dict $expected, ): void { - expect(DictHSL\pull($traversable, $value_func, $key_func)) + expect(Dict\pull($traversable, $value_func, $key_func)) ->toBeSame($expected); } @@ -593,7 +592,7 @@ public function testPullWithKey( (function(Tk1, Tv1): Tk2) $key_func, dict $expected, ): void { - expect(DictHSL\pull_with_key($traversable, $value_func, $key_func)) + expect(Dict\pull_with_key($traversable, $value_func, $key_func)) ->toBeSame($expected); } } diff --git a/tests/keyset/KeysetCombineTest.php b/tests/keyset/KeysetCombineTest.php index ba1e03ec..c9174af7 100644 --- a/tests/keyset/KeysetCombineTest.php +++ b/tests/keyset/KeysetCombineTest.php @@ -9,7 +9,7 @@ * */ -use \HH\Lib\Keyset as KeysetHSL; +use namespace \HH\Lib\Keyset; use function \Facebook\FBExpect\expect; /** @@ -44,6 +44,6 @@ public function testUnion( Container> $traversables, keyset $expected, ): void { - expect(KeysetHSL\union(...$traversables))->toBeSame($expected); + expect(Keyset\union(...$traversables))->toBeSame($expected); } } diff --git a/tests/keyset/KeysetDivideTest.php b/tests/keyset/KeysetDivideTest.php index 83b62786..8acb5b57 100644 --- a/tests/keyset/KeysetDivideTest.php +++ b/tests/keyset/KeysetDivideTest.php @@ -9,7 +9,7 @@ * */ -use \HH\Lib\Keyset as KeysetHSL; +use namespace \HH\Lib\Keyset; use function \Facebook\FBExpect\expect; /** @@ -44,6 +44,6 @@ public function testPartition( (function(Tv): bool) $predicate, (keyset, keyset) $expected, ): void { - expect(KeysetHSL\partition($traversable, $predicate))->toBeSame($expected); + expect(Keyset\partition($traversable, $predicate))->toBeSame($expected); } } diff --git a/tests/keyset/KeysetIntrospectTest.php b/tests/keyset/KeysetIntrospectTest.php index 3340cc20..bf4a4aac 100644 --- a/tests/keyset/KeysetIntrospectTest.php +++ b/tests/keyset/KeysetIntrospectTest.php @@ -9,7 +9,7 @@ * */ -use \HH\Lib\Keyset as KeysetHSL; +use namespace \HH\Lib\Keyset; use function \Facebook\FBExpect\expect; /** @@ -58,6 +58,6 @@ public function testEqual( keyset $keyset2, bool $expected, ): void { - expect(KeysetHSL\equal($keyset1, $keyset2))->toBeSame($expected); + expect(Keyset\equal($keyset1, $keyset2))->toBeSame($expected); } } diff --git a/tests/keyset/KeysetOrderTest.php b/tests/keyset/KeysetOrderTest.php index 95e50358..41a48b08 100644 --- a/tests/keyset/KeysetOrderTest.php +++ b/tests/keyset/KeysetOrderTest.php @@ -9,7 +9,7 @@ * */ -use \HH\Lib\Keyset as KeysetHSL; +use namespace \HH\Lib\Keyset; use function \Facebook\FBExpect\expect; /** @@ -48,7 +48,7 @@ public function testSort( ?(function(Tv, Tv): int) $comparator, keyset $expected, ): void { - expect(KeysetHSL\sort($traversable, $comparator))->toBeSame($expected); + expect(Keyset\sort($traversable, $comparator))->toBeSame($expected); } } diff --git a/tests/keyset/KeysetSelectTest.php b/tests/keyset/KeysetSelectTest.php index 6e83dc96..ebcdbea8 100644 --- a/tests/keyset/KeysetSelectTest.php +++ b/tests/keyset/KeysetSelectTest.php @@ -9,7 +9,7 @@ * */ -use \HH\Lib\Keyset as KeysetHSL; +use namespace \HH\Lib\Keyset; use function \Facebook\FBExpect\expect; /** @@ -50,7 +50,7 @@ public function testDiff( Container> $rest, keyset $expected, ): void { - expect(KeysetHSL\diff($first, $second, ...$rest)) + expect(Keyset\diff($first, $second, ...$rest)) ->toBeSame($expected); } @@ -90,7 +90,7 @@ public function testDrop( int $n, keyset $expected, ): void { - expect(KeysetHSL\drop($traversable, $n))->toBeSame($expected); + expect(Keyset\drop($traversable, $n))->toBeSame($expected); } public static function provideTestFilter(): array { @@ -134,13 +134,13 @@ public function testFilter( (function(Tv): bool) $predicate, keyset $expected, ): void { - expect(KeysetHSL\filter($traversable, $predicate)) + expect(Keyset\filter($traversable, $predicate)) ->toBeSame($expected); } public function testFilterWithoutPredicate(): void { expect( - KeysetHSL\filter(array(0, 3, 5, 40, '', '0', 'win!')) + Keyset\filter(array(0, 3, 5, 40, '', '0', 'win!')) )->toBeSame(keyset[3, 5, 40, 'win!']); } @@ -183,7 +183,7 @@ public function testFilterNulls( Traversable $traversable, keyset $expected, ): void { - expect(KeysetHSL\filter_nulls($traversable))->toBeSame($expected); + expect(Keyset\filter_nulls($traversable))->toBeSame($expected); } public static function provideTestKeys(): array { @@ -218,7 +218,7 @@ public function testKeys( KeyedTraversable $traversable, keyset $expected, ): void { - expect(KeysetHSL\keys($traversable))->toBeSame($expected); + expect(Keyset\keys($traversable))->toBeSame($expected); } public static function provideTestIntersect(): array { @@ -277,7 +277,7 @@ public function testIntersect( Container> $rest, keyset $expected, ): void { - expect(KeysetHSL\intersect($first, $second, ...$rest)) + expect(Keyset\intersect($first, $second, ...$rest)) ->toBeSame($expected); } @@ -323,7 +323,7 @@ public function testSlice( ?int $length, keyset $expected, ): void { - expect(KeysetHSL\slice($container, $offset, $length))->toBeSame($expected); + expect(Keyset\slice($container, $offset, $length))->toBeSame($expected); } public static function provideTake(): array { @@ -362,14 +362,14 @@ public function testTake( int $n, keyset $expected, ): void { - expect(KeysetHSL\take($traversable, $n))->toBeSame($expected); + expect(Keyset\take($traversable, $n))->toBeSame($expected); } public function testTakeIter(): void { $iter = HackLibTestTraversables::getIterator(range(0, 4)); - expect(KeysetHSL\take($iter, 2))->toBeSame(keyset[0, 1]); - expect(KeysetHSL\take($iter, 0))->toBeSame(keyset[]); - expect(KeysetHSL\take($iter, 2))->toBeSame(keyset[2, 3]); - expect(KeysetHSL\take($iter, 2))->toBeSame(keyset[4]); + expect(Keyset\take($iter, 2))->toBeSame(keyset[0, 1]); + expect(Keyset\take($iter, 0))->toBeSame(keyset[]); + expect(Keyset\take($iter, 2))->toBeSame(keyset[2, 3]); + expect(Keyset\take($iter, 2))->toBeSame(keyset[4]); } } diff --git a/tests/keyset/KeysetTransformTest.php b/tests/keyset/KeysetTransformTest.php index 3248a5f8..cc480afb 100644 --- a/tests/keyset/KeysetTransformTest.php +++ b/tests/keyset/KeysetTransformTest.php @@ -9,7 +9,7 @@ * */ -use \HH\Lib\Keyset as KeysetHSL; +use namespace \HH\Lib\Keyset; use function \Facebook\FBExpect\expect; /** @@ -62,7 +62,7 @@ public function testChunk( int $size, vec> $expected, ): void { - expect(KeysetHSL\chunk($traversable, $size))->toBeSame($expected); + expect(Keyset\chunk($traversable, $size))->toBeSame($expected); } public static function provideTestMap(): array { @@ -141,7 +141,7 @@ public function testMap( (function(Tv1): Tv2) $value_func, keyset $expected, ): void { - expect(KeysetHSL\map($traversable, $value_func))->toBeSame($expected); + expect(Keyset\map($traversable, $value_func))->toBeSame($expected); } public static function provideTestMapWithKey(): array { @@ -175,7 +175,7 @@ public function testMapWithKey( (function(Tk, Tv1): Tv2) $value_func, keyset $expected, ): void { - expect(KeysetHSL\map_with_key($traversable, $value_func)) + expect(Keyset\map_with_key($traversable, $value_func)) ->toBeSame($expected); } @@ -227,6 +227,6 @@ public function testFlatten( Traversable> $traversables, keyset $expected, ): void { - expect(KeysetHSL\flatten($traversables))->toBeSame($expected); + expect(Keyset\flatten($traversables))->toBeSame($expected); } } diff --git a/tests/math/MathComputeTest.php b/tests/math/MathComputeTest.php index ee71e0a1..defcda3b 100644 --- a/tests/math/MathComputeTest.php +++ b/tests/math/MathComputeTest.php @@ -9,7 +9,7 @@ * */ -use HH\Lib\{Math, Str}; +use namespace HH\Lib\{Math, Str}; use const HH\Lib\_Private\ALPHABET_ALPHANUMERIC; use function Facebook\FBExpect\expect; // @oss-disable: use InvariantViolationException as InvariantException; diff --git a/tests/math/MathContainersTest.php b/tests/math/MathContainersTest.php index 83e69cb6..7040e5b4 100644 --- a/tests/math/MathContainersTest.php +++ b/tests/math/MathContainersTest.php @@ -9,7 +9,7 @@ * */ -use HH\Lib\Math; +use namespace HH\Lib\Math; use function Facebook\FBExpect\expect; /** diff --git a/tests/str/StrCombineTest.php b/tests/str/StrCombineTest.php index 20aa03dc..f23ad5fe 100644 --- a/tests/str/StrCombineTest.php +++ b/tests/str/StrCombineTest.php @@ -9,7 +9,7 @@ * */ -use HH\Lib\Str; +use namespace HH\Lib\Str; use function Facebook\FBExpect\expect; /** diff --git a/tests/str/StrDivideTest.php b/tests/str/StrDivideTest.php index 74231f88..185343e8 100644 --- a/tests/str/StrDivideTest.php +++ b/tests/str/StrDivideTest.php @@ -9,7 +9,7 @@ * */ -use HH\Lib\Str; +use namespace HH\Lib\Str; use function Facebook\FBExpect\expect; /** diff --git a/tests/str/StrIntrospectTest.php b/tests/str/StrIntrospectTest.php index daadb0a7..fd8e2b7f 100644 --- a/tests/str/StrIntrospectTest.php +++ b/tests/str/StrIntrospectTest.php @@ -9,7 +9,7 @@ * */ -use HH\Lib\Str; +use namespace HH\Lib\Str; use function Facebook\FBExpect\expect; // @oss-disable: use InvariantViolationException as InvariantException; diff --git a/tests/str/StrSelectTest.php b/tests/str/StrSelectTest.php index 665269e6..37befb29 100644 --- a/tests/str/StrSelectTest.php +++ b/tests/str/StrSelectTest.php @@ -9,7 +9,7 @@ * */ -use HH\Lib\Str; +use namespace HH\Lib\Str; use function Facebook\FBExpect\expect; // @oss-disable: use InvariantViolationException as InvariantException; diff --git a/tests/str/StrTransformTest.php b/tests/str/StrTransformTest.php index e393b13c..11c572f8 100644 --- a/tests/str/StrTransformTest.php +++ b/tests/str/StrTransformTest.php @@ -9,7 +9,7 @@ * */ -use HH\Lib\Str; +use namespace HH\Lib\Str; use function Facebook\FBExpect\expect; // @oss-disable: use InvariantViolationException as InvariantException; diff --git a/tests/vec/VecCombineTest.php b/tests/vec/VecCombineTest.php index 06164290..b744918c 100644 --- a/tests/vec/VecCombineTest.php +++ b/tests/vec/VecCombineTest.php @@ -9,7 +9,7 @@ * */ -use \HH\Lib\Vec as VecHSL; +use namespace \HH\Lib\Vec; use function \Facebook\FBExpect\expect; /** @@ -46,7 +46,7 @@ public function testConcat( Container> $traversables, vec $expected, ): void { - expect(VecHSL\concat(...$traversables))->toBeSame($expected); + expect(Vec\concat(...$traversables))->toBeSame($expected); } } diff --git a/tests/vec/VecDivideTest.php b/tests/vec/VecDivideTest.php index ae3b42d2..7cab43d0 100644 --- a/tests/vec/VecDivideTest.php +++ b/tests/vec/VecDivideTest.php @@ -9,7 +9,7 @@ * */ -use HH\Lib\Vec as VecHSL; +use namespace HH\Lib\Vec; use function \Facebook\FBExpect\expect; /** @@ -44,6 +44,6 @@ public function testPartition( (function(Tv): bool) $predicate, (vec, vec) $expected, ): void { - expect(VecHSL\partition($traversable, $predicate))->toBeSame($expected); + expect(Vec\partition($traversable, $predicate))->toBeSame($expected); } } diff --git a/tests/vec/VecOrderTest.php b/tests/vec/VecOrderTest.php index 6b0db331..1e4a078f 100644 --- a/tests/vec/VecOrderTest.php +++ b/tests/vec/VecOrderTest.php @@ -9,8 +9,7 @@ * */ -use HH\Lib\Vec as VecHSL; -use HH\Lib\{C, Math, Str}; +use namespace HH\Lib\{C, Math, Str, Vec}; use function \Facebook\FBExpect\expect; // @oss-disable: use InvariantViolationException as InvariantException; @@ -73,7 +72,7 @@ public function testRange( ?Tv $increment, vec $expected, ): void { - $actual = VecHSL\range($start, $end, $increment); + $actual = Vec\range($start, $end, $increment); expect(C\count($actual))->toBeSame(C\count($expected)); for ($i = 0; $i < C\count($actual); $i++) { expect((float) $actual[$i])->toAlmostEqual((float) $expected[$i]); @@ -93,7 +92,7 @@ public function testRangeException( Tv $end, Tv $increment, ): void { - expect(() ==> VecHSL\range($start, $end, $increment)) + expect(() ==> Vec\range($start, $end, $increment)) ->toThrow(InvariantException::class); } @@ -119,7 +118,7 @@ public function testReverse( Traversable $traversable, vec $expected, ): void { - expect(VecHSL\reverse($traversable))->toBeSame($expected); + expect(Vec\reverse($traversable))->toBeSame($expected); } public static function provideTestShuffle(): array { @@ -155,7 +154,7 @@ public function testShuffle( ->mockImplementation(fun('sort')); } - $shuffled = VecHSL\shuffle($traversable); + $shuffled = Vec\shuffle($traversable); expect($shuffled)->toBeSame($expected); } finally { // UNSAFE_BLOCK: flib IntegrationTest doesn't exist in open source @@ -195,7 +194,7 @@ public function testSort( ?(function(Tv, Tv): int) $comparator, vec $expected, ): void { - expect(VecHSL\sort($traversable, $comparator))->toBeSame($expected); + expect(Vec\sort($traversable, $comparator))->toBeSame($expected); } public static function provideTestSortBy(): array { @@ -248,7 +247,7 @@ public function testSortBy( ?(function(Ts, Ts): int) $comparator, vec $expected, ): void { - expect(VecHSL\sort_by($traversable, $scalar_func, $comparator)) + expect(Vec\sort_by($traversable, $scalar_func, $comparator)) ->toBeSame($expected); } } diff --git a/tests/vec/VecSelectTest.php b/tests/vec/VecSelectTest.php index 1ae90d01..91dc094f 100644 --- a/tests/vec/VecSelectTest.php +++ b/tests/vec/VecSelectTest.php @@ -9,8 +9,7 @@ * */ -use HH\Lib\Vec as VecHSL; -use HH\Lib\{C, Math, Str}; +use namespace HH\Lib\{C, Math, Str, Vec}; use function \Facebook\FBExpect\expect; /** @@ -45,7 +44,7 @@ public function testDiff( Container> $traversables, vec $expected, ): void { - expect(VecHSL\diff($base, ...$traversables))->toBeSame($expected); + expect(Vec\diff($base, ...$traversables))->toBeSame($expected); } public static function provideTestDiffBy(): array { @@ -80,7 +79,7 @@ public function testDiffBy( (function(Tv): Ts) $scalar_func, vec $expected, ): void { - expect(VecHSL\diff_by($first, $second, $scalar_func)) + expect(Vec\diff_by($first, $second, $scalar_func)) ->toBeSame($expected); } @@ -120,7 +119,7 @@ public function testDrop( int $n, vec $expected, ): void { - expect(VecHSL\drop($traversable, $n))->toBeSame($expected); + expect(Vec\drop($traversable, $n))->toBeSame($expected); } public static function provideTestFilter(): array { @@ -164,11 +163,11 @@ public function testFilter( (function(Tv): bool) $value_predicate, vec $expected, ): void { - expect(VecHSL\filter($traversable, $value_predicate))->toBeSame($expected); + expect(Vec\filter($traversable, $value_predicate))->toBeSame($expected); } public function testFilterWithoutPredicate(): void { - expect(VecHSL\filter(array( + expect(Vec\filter(array( 0, 3, null, 5, false, 40, '', '0', 'win!', )))->toBeSame(vec[3, 5, 40, 'win!']); } @@ -213,7 +212,7 @@ public function testFilterNulls( Traversable $traversable, vec $expected, ): void { - expect(VecHSL\filter_nulls($traversable))->toBeSame($expected); + expect(Vec\filter_nulls($traversable))->toBeSame($expected); } public static function provideTestIntersect(): array { @@ -272,7 +271,7 @@ public function testIntersect( Container> $rest, vec $expected, ): void { - expect(VecHSL\intersect($first, $second, ...$rest))->toBeSame($expected); + expect(Vec\intersect($first, $second, ...$rest))->toBeSame($expected); } public static function provideTestKeys(): array { @@ -320,7 +319,7 @@ public function testKeys( KeyedTraversable $traversable, vec $expected, ): void { - expect(VecHSL\keys($traversable))->toBeSame($expected); + expect(Vec\keys($traversable))->toBeSame($expected); } public static function provideTestSample(): array { @@ -346,13 +345,13 @@ public function testSample( int $sample_size, ): void { $expected_size = Math\min(C\count(vec($traversable)), $sample_size); - expect(C\count(VecHSL\sample($traversable, $sample_size))) + expect(C\count(Vec\sample($traversable, $sample_size))) ->toBeSame($expected_size); } public function testSampleIterator(): void { $iterator = HackLibTestTraversables::getIterator(range(0, 5)); - expect(C\count(VecHSL\sample($iterator, 3)))->toBeSame(3); + expect(C\count(Vec\sample($iterator, 3)))->toBeSame(3); } public static function provideTestSlice(): array { @@ -391,7 +390,7 @@ public function testSlice( ?int $length, vec $expected, ): void { - expect(VecHSL\slice($container, $offset, $length))->toBeSame($expected); + expect(Vec\slice($container, $offset, $length))->toBeSame($expected); } public static function provideTake(): array { @@ -430,15 +429,15 @@ public function testTake( int $n, vec $expected, ): void { - expect(VecHSL\take($traversable, $n))->toBeSame($expected); + expect(Vec\take($traversable, $n))->toBeSame($expected); } public function testTakeIter(): void { $iter = HackLibTestTraversables::getIterator(range(0, 4)); - expect(VecHSL\take($iter, 2))->toBeSame(vec[0, 1]); - expect(VecHSL\take($iter, 0))->toBeSame(vec[]); - expect(VecHSL\take($iter, 2))->toBeSame(vec[2, 3]); - expect(VecHSL\take($iter, 2))->toBeSame(vec[4]); + expect(Vec\take($iter, 2))->toBeSame(vec[0, 1]); + expect(Vec\take($iter, 0))->toBeSame(vec[]); + expect(Vec\take($iter, 2))->toBeSame(vec[2, 3]); + expect(Vec\take($iter, 2))->toBeSame(vec[4]); } public static function provideTestUnique(): array { @@ -461,7 +460,7 @@ public function testUnique( Traversable $traversable, vec $expected, ): void { - expect(VecHSL\unique($traversable))->toBeSame($expected); + expect(Vec\unique($traversable))->toBeSame($expected); } public static function provideTestUniqueBy(): array { @@ -505,7 +504,7 @@ public function testUniqueBy( (function(Tv): Ts) $scalar_func, vec $expected, ): void { - expect(VecHSL\unique_by($traversable, $scalar_func)) + expect(Vec\unique_by($traversable, $scalar_func)) ->toBeSame($expected); } diff --git a/tests/vec/VecTransformTest.php b/tests/vec/VecTransformTest.php index 29922204..a5769ce5 100644 --- a/tests/vec/VecTransformTest.php +++ b/tests/vec/VecTransformTest.php @@ -9,7 +9,7 @@ * */ -use HH\Lib\Vec as VecHSL; +use namespace HH\Lib\Vec; use function \Facebook\FBExpect\expect; /** @@ -52,7 +52,7 @@ public function testChunk( int $size, vec> $expected, ): void { - expect(VecHSL\chunk($traversable, $size))->toBeSame($expected); + expect(Vec\chunk($traversable, $size))->toBeSame($expected); } public static function provideTestFill(): array { @@ -84,7 +84,7 @@ public function testFill( Tv $value, vec $expected, ): void { - expect(VecHSL\fill($size, $value))->toBeSame($expected); + expect(Vec\fill($size, $value))->toBeSame($expected); } public static function provideTestFlatten(): array { @@ -116,7 +116,7 @@ public function testFlatten( Traversable> $traversables, vec $expected, ): void { - expect(VecHSL\flatten($traversables))->toBeSame($expected); + expect(Vec\flatten($traversables))->toBeSame($expected); } public static function provideTestMap(): array { @@ -195,7 +195,7 @@ public function testMap( (function(Tv1): Tv2) $value_func, vec $expected, ): void { - expect(VecHSL\map($traversable, $value_func))->toBeSame($expected); + expect(Vec\map($traversable, $value_func))->toBeSame($expected); } public static function provideTestMapWithKey(): array { @@ -224,7 +224,7 @@ public function testMapWithKey( (function(Tk, Tv1): Tv2) $value_func, vec $expected, ): void { - expect(VecHSL\map_with_key($traversable, $value_func))->toBeSame($expected); + expect(Vec\map_with_key($traversable, $value_func))->toBeSame($expected); } }