Example #1
0
 /**
  * Union join the values of one or more with this Seq and return a new Seq
  * @param array $arrayLikeN An array of transversable
  * @return Seq
  */
 public function union(...$arrayLikeN)
 {
     $output = [$this->hash];
     foreach ($arrayLikeN as $arg => $value) {
         $output[] = __PRIVATE__::traversableToArray(__CONTRACT__::argIsATraversable($value, $arg));
     }
     return static::from(call_user_func_array('array_merge', $output));
 }
Example #2
0
 /**
  * Checks the return of a callback to be of the expected type
  * @param string $classPath
  * @param mixed $returnValue
  * @return mixed
  * @throws \UnexpectedValueException
  */
 static function returnIsA($classPath, $returnValue)
 {
     if ($returnValue instanceof $classPath) {
         return $returnValue;
     }
     throw new invalidReturn($returnValue, "Expected return of {$classPath}, got " . __PRIVATE__::getDescriptor($returnValue));
 }
Example #3
0
     */
    public static function getArity(callable $fn)
    {
        return self::reflectCallable($fn)->getNumberOfRequiredParameters();
    }
    // -- Magic Methods --
    /**
     * @codeCoverageIgnore
     */
    protected function __clone()
    {
        // This space intentionally left blank
    }
    /**
     * @codeCoverageIgnore
     */
    protected function __wakeup()
    {
        // This space intentionally left blank
    }
    /**
     * None constructor.
     * @codeCoverageIgnore
     */
    protected function __construct()
    {
        // This space intentionally left blank
    }
}
__PRIVATE__::initialize();
Example #4
0
 /**
  * @covers ::getArity
  * @dataProvider callableProvider
  */
 public function test_getArity(callable $callable, $descriptor)
 {
     self::assertEquals($descriptor['arity'], internal::getArity($callable));
 }