Skip to content

Commit

Permalink
Merge pull request #9 from simPod/drop-deprecated
Browse files Browse the repository at this point in the history
Drop deprecated functions `withMap()` and `withFilter()`
  • Loading branch information
bpolaszek authored Jan 17, 2021
2 parents b6d6b9d + 699d41d commit 92fbe97
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 52 deletions.
20 changes: 0 additions & 20 deletions src/IterableObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,26 +79,6 @@ public function map($map)
return new self($this->iterable, $this->filter, $map);
}

/**
* @param callable $filter
* @return self
* @deprecated Use IterableObject::filter instead.
*/
public function withFilter($filter)
{
return $this->filter($filter);
}

/**
* @param callable $map
* @return self
* @deprecated Use IterableObject::map instead.
*/
public function withMap($map)
{
return $this->map($map);
}

/**
* @inheritdoc
*/
Expand Down
32 changes: 0 additions & 32 deletions tests/TestIterableObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,38 +43,6 @@ public function testFromTraversableToArray($data, $filter = null, $map = null, $
$this->assertEquals($expectedResult, $iterableObject->asArray());
}

public function testFilterMutator()
{
$filter = function ($value) {
return 'bar' === $value;
};
$iterableObject = iterable(array('foo', 'bar'))->withFilter($filter);
$this->assertEquals(array(1 => 'bar'), iterator_to_array($iterableObject));
}

public function testMapMutator()
{
$map = 'strtoupper';
$iterableObject = iterable(array('foo', 'bar'))->withMap($map);
$this->assertEquals(array('FOO', 'BAR'), iterator_to_array($iterableObject));
}

public function testFilterAndMapMutators()
{
$filter = function ($value) {
return 'bar' === $value;
};
$map = 'strtoupper';
$iterableObject = iterable(array('foo', 'bar'))->withMap($map)->withFilter($filter);
$this->assertEquals(array(1 => 'BAR'), iterator_to_array($iterableObject));
$iterableObject = iterable(array('foo', 'bar'))->map($map)->filter($filter);
$this->assertEquals(array(1 => 'BAR'), iterator_to_array($iterableObject));
$iterableObject = iterable(array('foo', 'bar'))->withFilter($filter)->withMap($map);
$this->assertEquals(array(1 => 'BAR'), iterator_to_array($iterableObject));
$iterableObject = iterable(array('foo', 'bar'))->filter($filter)->map($map);
$this->assertEquals(array(1 => 'BAR'), iterator_to_array($iterableObject));
}

public function dataProvider()
{
$data = array('foo', 'bar');
Expand Down

0 comments on commit 92fbe97

Please sign in to comment.