Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stub out PHPism and FBLogger #26

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/keyset/transform.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

namespace HH\Lib\Keyset;

// @oss-disable: use \PHPism_FIXME as PHPism_FIXME;
use HH\Lib\_Private\StubPHPism_FIXME as PHPism_FIXME; // @oss-enable
use function HH\Lib\_Private\universal_chainable_stub as FBLogger; // @oss-enable

/**
* Returns a vec containing the given Traversable split into chunks of the
* given size.
Expand Down Expand Up @@ -78,7 +82,7 @@ function flatten<Tv as arraykey>(
): keyset<Tv> {
$result = keyset[];
foreach ($traversables as $traversable) {
if (!\PHPism_FIXME::isForeachable($traversable)) {
if (!PHPism_FIXME::isForeachable($traversable)) {
FBLogger('phpism_fixme.invalid_foreach_arg')
->blameToPreviousFrame()
->mustfix('Attempting to foreach over a non-foreachable type');
Expand Down
18 changes: 18 additions & 0 deletions src/private.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,21 @@ function validate_offset(

const string ALPHABET_ALPHANUMERIC =
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';

// Stub implementations of FB internals used to ease migrations

final class StubPHPism_FIXME {
public static function isForeachable<T>(Traversable<T> $_): bool {
return true;
}
}

final class UniversalChainableStub {
public function __call(mixed $_, mixed $_): this {
return $this;
}
}

function universal_chainable_stub(mixed ...$_): UniversalChainableStub {
return new UniversalChainableStub();
}