From 7f7be00701ebd77d23fc559356da9ca1575bd380 Mon Sep 17 00:00:00 2001 From: maks Date: Mon, 5 Aug 2019 16:59:45 +0200 Subject: [PATCH] update return type test logic - use internal property `$allowedReturnTypes` (maybe making it a static property or a class constant would be advisable) - use strict `in_array` test as for instance this expression `in_array(0, ['a', 'b'])` evaluates to true --- src/ResultSet/ResultSet.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ResultSet/ResultSet.php b/src/ResultSet/ResultSet.php index ebbb455c3b..c66ad2dc50 100644 --- a/src/ResultSet/ResultSet.php +++ b/src/ResultSet/ResultSet.php @@ -46,7 +46,7 @@ class ResultSet extends AbstractResultSet */ public function __construct($returnType = self::TYPE_ARRAYOBJECT, $arrayObjectPrototype = null) { - if (in_array($returnType, [self::TYPE_ARRAY, self::TYPE_ARRAYOBJECT])) { + if (in_array($returnType, $this->allowedReturnTypes, true)) { $this->returnType = $returnType; } else { $this->returnType = self::TYPE_ARRAYOBJECT;