Skip to content

Instantly share code, notes, and snippets.

@philsturgeon
Last active January 3, 2016 09:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save philsturgeon/8443648 to your computer and use it in GitHub Desktop.
Save philsturgeon/8443648 to your computer and use it in GitHub Desktop.
Array Of Syntax should represent the following code https://wiki.php.net/rfc/arrayof

Option A)

Null content items break things.

foreach ($foos as $foo) {
    if (! $foo instanceof Face) {
        throw new Exception ('AAAGGGGGHHH!');
    }
}

Optin B)

Nulls are great.

foreach ($foos as $foo) {
    if (! is_null($foo) and ! $foo instanceof Face) {
        throw new Exception ('AAAGGGGGHHH!');
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment