From 97eb855eb6b7671b1d7cec2495ee0d81039a04a3 Mon Sep 17 00:00:00 2001 From: Mark Sch Date: Sat, 20 Jan 2018 21:00:03 +0100 Subject: [PATCH] Improve getBehavior() nullable check --- src/ORM/Table.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ORM/Table.php b/src/ORM/Table.php index 1d2e825521b..37caf5433dd 100644 --- a/src/ORM/Table.php +++ b/src/ORM/Table.php @@ -931,7 +931,8 @@ 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, @@ -939,7 +940,7 @@ public function getBehavior($name) )); } - return $this->_behaviors->get($name); + return $behavior; } /**