Skip to content

Commit

Permalink
Changes Reserved Iterable name to IterableType (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkVaughn authored Jan 23, 2017
1 parent 771f8eb commit c05d9c2
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 38 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ language: php
php:
- 5.6
- 7.0
- 7.1
- hhvm
branches:
only:
- master
before_script:
- composer self-update
- sh -c 'if [ "$TRAVIS_PHP_VERSION" = "hhvm" -o "$TRAVIS_PHP_VERSION" = "hhvm-nightly"
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
}
},
"require": {
"lstrojny/phpunit-function-mocker": "0.2.*"
"lstrojny/phpunit-function-mocker": "0.4.*"
}
}
4 changes: 2 additions & 2 deletions src/SellerLabs/Nucleus/Data/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @author Eduardo Trujillo <[email protected]>
* @package SellerLabs\Nucleus\Data
*/
abstract class Collection extends Iterable
abstract class Collection extends IterableType
{
//
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
use SellerLabs\Nucleus\Meditation\Constraints\AbstractTypeConstraint;

/**
* Class Iterable.
* Class IterableType.
*
* @author Eduardo Trujillo <[email protected]>
* @package SellerLabs\Nucleus\Data
*/
abstract class Iterable extends BaseObject implements
abstract class IterableType extends BaseObject implements
ArrayableInterface,
FunctorInterface,
FoldableInterface,
Expand Down Expand Up @@ -82,14 +82,14 @@ public function last()
}

/**
* @param array|Iterable $searchKeyPath
* @param array|IterableType $searchKeyPath
*
* @return Maybe
*/
abstract public function lookupIn($searchKeyPath);

/**
* @param array|Iterable $searchKeyPath
* @param array|IterableType $searchKeyPath
*
* @return mixed
*/
Expand All @@ -103,14 +103,14 @@ abstract public function toArray();
/**
* @param callable $callable
*
* @return Iterable
* @return IterableType
*/
abstract public function fmap(callable $callable);

/**
* @param callable $callable
*
* @return static|Iterable
* @return static|IterableType
*/
public function map(callable $callable)
{
Expand All @@ -120,14 +120,14 @@ public function map(callable $callable)
/**
* @param callable $callable
*
* @return Iterable
* @return IterableType
*/
abstract public function filter(callable $callable);

/**
* @param callable $callable
*
* @return Iterable
* @return IterableType
*/
public function filterNot(callable $callable)
{
Expand All @@ -139,22 +139,22 @@ function ($value, $key, $iterable) use ($callable) {
}

/**
* @return Iterable
* @return IterableType
*/
abstract public function reverse();

/**
* @param callable $comparator
*
* @return Iterable
* @return IterableType
*/
abstract public function sort(callable $comparator = null);

/**
* @param callable $comparatorValueMapper
* @param callable|null $comparator
*
* @return Iterable
* @return IterableType
*/
public function sortBy(
callable $comparatorValueMapper,
Expand All @@ -174,20 +174,20 @@ abstract public function each(callable $sideEffect);
* @param int $begin
* @param int|null $end
*
* @return Iterable
* @return IterableType
*/
abstract public function slice($begin, $end = null);

/**
* @return Iterable
* @return IterableType
*/
public function tail()
{
return $this->slice(1);
}

/**
* @return Iterable
* @return IterableType
*/
public function init()
{
Expand All @@ -197,7 +197,7 @@ public function init()
/**
* @param int $amount
*
* @return Iterable
* @return IterableType
*/
public function take($amount)
{
Expand All @@ -212,7 +212,7 @@ public function take($amount)
/**
* @param int $amount
*
* @return Iterable
* @return IterableType
*/
public function takeLast($amount)
{
Expand All @@ -222,14 +222,14 @@ public function takeLast($amount)
/**
* @param callable $predicate
*
* @return Iterable
* @return IterableType
*/
abstract public function takeWhile(callable $predicate);

/**
* @param callable $predicate
*
* @return Iterable
* @return IterableType
*/
public function takeUntil(callable $predicate)
{
Expand Down
18 changes: 9 additions & 9 deletions src/SellerLabs/Nucleus/Data/Traits/ArrayBackingTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use SellerLabs\Nucleus\Data\Interfaces\FunctorInterface;
use SellerLabs\Nucleus\Data\Interfaces\ListInterface;
use SellerLabs\Nucleus\Data\Interfaces\MonoidInterface;
use SellerLabs\Nucleus\Data\Iterable;
use SellerLabs\Nucleus\Data\IterableType;
use SellerLabs\Nucleus\Exceptions\CoreException;
use SellerLabs\Nucleus\Exceptions\MindTheGapException;
use SellerLabs\Nucleus\Meditation\Arguments;
Expand Down Expand Up @@ -130,7 +130,7 @@ public function foldlWithKeys(callable $callback, $initial)
* @param int $begin
* @param int $end
*
* @return Iterable
* @return IterableType
* @throws CoreException
* @throws InvalidArgumentException
*/
Expand Down Expand Up @@ -174,7 +174,7 @@ public function slice($begin, $end = null)
/**
* @param callable $predicate
*
* @return Iterable
* @return IterableType
*/
public function takeWhile(callable $predicate)
{
Expand Down Expand Up @@ -250,7 +250,7 @@ public function member($key)
}

/**
* @param array|Iterable $searchKeyPath
* @param array|IterableType $searchKeyPath
*
* @return Maybe
*/
Expand All @@ -274,15 +274,15 @@ public function lookupIn($searchKeyPath)

$innerValue = Maybe::fromJust($value);

if ($innerValue instanceof Iterable) {
if ($innerValue instanceof IterableType) {
return $innerValue->lookupIn($path->tail());
}

return Maybe::nothing();
}

/**
* @param array|Iterable $searchKeyPath
* @param array|IterableType $searchKeyPath
*
* @return bool
* @throws MindTheGapException
Expand All @@ -305,7 +305,7 @@ public function memberIn($searchKeyPath)

$innerValue = Maybe::fromJust($this->lookup($path->head()));

if ($innerValue instanceof Iterable) {
if ($innerValue instanceof IterableType) {
return $innerValue->memberIn($path->tail());
}

Expand All @@ -315,7 +315,7 @@ public function memberIn($searchKeyPath)
/**
* @param callable $comparator
*
* @return Iterable
* @return IterableType
*/
public function sort(callable $comparator = null)
{
Expand Down Expand Up @@ -372,7 +372,7 @@ public function delete($key)
*
* @param array $excluded
*
* @return static|Iterable
* @return static|IterableType
* @throws InvalidArgumentException
*/
public function exceptValues($excluded = [])
Expand Down
10 changes: 5 additions & 5 deletions src/SellerLabs/Nucleus/Meditation/Spec.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use SellerLabs\Nucleus\Data\ArrayList;
use SellerLabs\Nucleus\Data\ArrayMap;
use SellerLabs\Nucleus\Data\Interfaces\LeftKeyFoldableInterface;
use SellerLabs\Nucleus\Data\Iterable;
use SellerLabs\Nucleus\Data\IterableType;
use SellerLabs\Nucleus\Exceptions\CoreException;
use SellerLabs\Nucleus\Foundation\BaseObject;
use SellerLabs\Nucleus\Meditation\Constraints\AbstractConstraint;
Expand Down Expand Up @@ -240,7 +240,7 @@ function ($constraint) use (
*
* @param string $fieldName
*
* @return Iterable
* @return IterableType
*/
protected function getInternalFieldConstraints($fieldName)
{
Expand All @@ -252,7 +252,7 @@ protected function getInternalFieldConstraints($fieldName)
*
* @param string $fieldName
*
* @return Iterable
* @return IterableType
*/
public function getFieldConstraints($fieldName)
{
Expand All @@ -268,7 +268,7 @@ public function getFieldConstraints($fieldName)

if (is_array($constraints)) {
return ArrayList::of($constraints);
} elseif ($constraints instanceof Iterable) {
} elseif ($constraints instanceof IterableType) {
return $constraints;
}

Expand Down Expand Up @@ -400,7 +400,7 @@ public function getFieldAnnotations($fieldName)
* Set the constraints for a field.
*
* @param string $fieldName
* @param Iterable|array|AbstractConstraint $constraints
* @param IterableType|array|AbstractConstraint $constraints
*
* @return static
*/
Expand Down
6 changes: 3 additions & 3 deletions src/SellerLabs/Nucleus/Meditation/TypedSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use SellerLabs\Nucleus\Control\Maybe;
use SellerLabs\Nucleus\Data\ArrayList;
use SellerLabs\Nucleus\Data\ArrayMap;
use SellerLabs\Nucleus\Data\Iterable;
use SellerLabs\Nucleus\Data\IterableType;
use SellerLabs\Nucleus\Meditation\Constraints\AbstractTypeConstraint;

/**
Expand Down Expand Up @@ -50,7 +50,7 @@ public function getTypes()
*
* @param string $fieldName
*
* @return Iterable
* @return IterableType
*/
protected function getInternalFieldConstraints($fieldName)
{
Expand All @@ -72,4 +72,4 @@ public function getFieldType($fieldName)
$this->getFieldAnnotation($fieldName, static::ANNOTATION_TYPE)
);
}
}
}

0 comments on commit c05d9c2

Please sign in to comment.