Skip to content

Instantly share code, notes, and snippets.

@icambridge
Last active February 23, 2017 16:50
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 icambridge/1f894e6e1bd7c1054c83998a20f3d768 to your computer and use it in GitHub Desktop.
Save icambridge/1f894e6e1bd7c1054c83998a20f3d768 to your computer and use it in GitHub Desktop.
Code Review: Sanity Checks
<?php
$logger = getLogger();
if (($logger instanceof Logger) == false) {
exit(-1);
}
<?php
$people = getNumberOfPeople();
if ($people === null) {
exit(-1);
}
// do numeric logic
<?php
$logger = getLogger();
if ($logger == null) {
exit(-1);
}
<?php
$people = getNumberOfPeople();
if (is_numeric($people) == false) {
exit(-1);
}
// do numeric logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment