Ian Littman / @iansltx
function get(?int $id) : ?MyObject {
// return either a MyObject or null
}
class MyObject
{
protected const SECRET = "yoloswag";
}
function executeAThing() : void
{
// doesn't return anything
}
[$a, $b, $c] = returnsAThreeLengthArray();
function doAThingOnASet(iterable $set)
{
// foreach over a thing
// array or Traversable
}
try {
// do something risky
} catch (BadThing | BlackSwanEvent $e) {
// handle these exception types
}
$strlenIsNowAClosure =
Closure::fromCallable('strlen');