Skip to content

Commit

Permalink
Improve getBehavior() nullable check
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Jan 20, 2018
1 parent d06728b commit 97eb855
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ORM/Table.php
Expand Up @@ -931,15 +931,16 @@ public function behaviors()
*/
public function getBehavior($name)
{
if ($this->hasBehavior($name) === false) {
$behavior = $this->_behaviors->get($name);
if ($behavior === null) {
throw new InvalidArgumentException(sprintf(
'The %s behavior is not defined on %s.',
$name,
get_class($this)
));
}

return $this->_behaviors->get($name);
return $behavior;
}

/**
Expand Down

0 comments on commit 97eb855

Please sign in to comment.