Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions src/ArrayHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -953,20 +953,6 @@ public static function isIn($needle, iterable $haystack, bool $strict = false):
return false;
}

/**
* Checks whether a variable is an array or [[\Traversable]].
*
* This method does the same as the PHP function [is_array()](http://php.net/manual/en/function.is-array.php)
* but additionally works on objects that implement the [[\Traversable]] interface.
* @param mixed $var The variable being evaluated.
* @return bool whether $var is array-like
* @see http://php.net/manual/en/function.is-array.php
*/
public static function isTraversable($var): bool
{
return is_iterable($var);
}

/**
* Checks whether an array or [[\Traversable]] is a subset of another array or [[\Traversable]].
*
Expand Down
12 changes: 0 additions & 12 deletions tests/ArrayHelper/ArrayHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use ArrayObject;
use PHPUnit\Framework\TestCase;
use stdClass;
use Yiisoft\Arrays\ArrayableInterface;
use Yiisoft\Arrays\ArrayHelper;
use Yiisoft\Arrays\Tests\Objects\ObjectWithNestedArrayableObject;
Expand Down Expand Up @@ -584,17 +583,6 @@ public function testIsSubset(): void
$this->assertFalse(ArrayHelper::isSubset(new ArrayObject([1]), ['1', 'b'], true));
}

public function testIsArray(): void
{
$this->assertTrue(ArrayHelper::isTraversable(['a']));
$this->assertTrue(ArrayHelper::isTraversable(new ArrayObject(['1'])));
$this->assertFalse(ArrayHelper::isTraversable(new stdClass()));
$this->assertFalse(ArrayHelper::isTraversable('A,B,C'));
$this->assertFalse(ArrayHelper::isTraversable(12));
$this->assertFalse(ArrayHelper::isTraversable(false));
$this->assertFalse(ArrayHelper::isTraversable(null));
}

public function testFilter(): void
{
$array = [
Expand Down