Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
update return type test logic
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
pine3ree committed Aug 5, 2019
1 parent 4c68f2c commit 7f7be00
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ResultSet/ResultSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7f7be00

Please sign in to comment.