Skip to content

Instantly share code, notes, and snippets.

@timkelty
Last active January 18, 2021 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timkelty/c96c80104197f5bab929821e1400f45c to your computer and use it in GitHub Desktop.
Save timkelty/c96c80104197f5bab929821e1400f45c to your computer and use it in GitHub Desktop.
<?php
// Type juggle keys as string or array
// -------------------------------------
public function getFoo(mixed $keyOrKeys)
{
}
// Variable args
// -------------------------------------
public function getFoo(string ...$keys)
{
}
// Explicit typed methods
// -------------------------------------
public function getFoo(string $key)
{
}
public function getManyFoo(array $keys)
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment