for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace loophp\combinator\Combinator;
use Closure;
use loophp\combinator\Combinator;
/**
* Class S.
*
* @psalm-template AType
* @psalm-template BType
* @psalm-template CType
*/
final class S extends Combinator
{
* @var callable
private $f;
private $g;
* @var mixed
private $x;
* S constructor.
* @psalm-param callable(AType): callable(BType): CType $f
* @psalm-param callable(AType): BType $g
* @psalm-param AType $x
* @param callable $f
* @param callable $g
* @param mixed $x
public function __construct(callable $f, callable $g, $x)
$this->f = $f;
$this->g = $g;
$this->x = $x;
}
* @psalm-return CType
public function __invoke()
return ($this->f)($this->x)(($this->g)($this->x));
* @param callable $a
* @return Closure
public static function on(callable $a): Closure
return static function (callable $b) use ($a): Closure {
return static function ($c) use ($a, $b) {
return (new self($a, $b, $c))();
};