Return false instead of null for boolean attributes

This commit is contained in:
Dave Rolsky
2014-10-28 10:27:18 -05:00
parent caf91dd247
commit c44053c276
5 changed files with 32 additions and 6 deletions
+5 -1
View File
@@ -25,7 +25,11 @@ abstract class AbstractRecord implements \JsonSerializable
if ($this->__isset($attr)) {
return $this->record[$key];
} elseif ($this->validAttribute($attr)) {
return null;
if (preg_match('/^is_/', $key)) {
return false;
} else {
return null;
}
} else {
throw new \RuntimeException("Unknown attribute: $attr");
}