diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 57d8eac..fd9654b 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1,2 @@ -github: loophp +github: drupol +custom: ["https://www.paypal.me/drupol"] diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 192ce52..e06784b 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -33,7 +33,7 @@ jobs: run: echo "::set-output name=dir::$(composer config cache-files-dir)" - name: Cache dependencies - uses: actions/cache@v1 + uses: actions/cache@v2 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} @@ -43,7 +43,7 @@ jobs: run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader - name: Run Grumphp - run: vendor/bin/grumphp run + run: vendor/bin/grumphp run --no-ansi -n env: STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} @@ -51,6 +51,20 @@ jobs: run: vendor/bin/psalm --shepherd --stats continue-on-error: true - - name: Scrutinizer - run: vendor/bin/ocular code-coverage:upload --format=php-clover build/logs/clover.xml + - name: Send Scrutinizer data + run: | + wget https://scrutinizer-ci.com/ocular.phar + php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml + continue-on-error: true + + - name: Infection score report + run: | + vendor/bin/infection run -j 2 + continue-on-error: true + + - name: PHP Insights report + run: | + rm -rf composer.lock vendor + composer require nunomaduro/phpinsights --dev + vendor/bin/phpinsights analyse src/ -n continue-on-error: true diff --git a/composer.json b/composer.json index 0b857c8..d151103 100644 --- a/composer.json +++ b/composer.json @@ -18,14 +18,13 @@ "php": ">= 7.1.3" }, "require-dev": { - "drupol/php-conventions": "^1.6.14", + "drupol/php-conventions": "^1.7.1", "friends-of-phpspec/phpspec-code-coverage": "^4.3.2", "infection/infection": "^0.13.6", - "phpspec/phpspec": "^5.1.2 || ^6.1.1", - "phpstan/phpstan": "^0.12.8", + "phpspec/phpspec": "^5.1.2 || ^6.2.1", + "phpstan/phpstan": "^0.12.32", "phpstan/phpstan-strict-rules": "^0.12", - "scrutinizer/ocular": "^1.6", - "vimeo/psalm": "^3.8.3" + "vimeo/psalm": "^3.12.2" }, "config": { "sort-packages": true diff --git a/src/Combinator.php b/src/Combinator.php index 56ccb78..bc88e70 100644 --- a/src/Combinator.php +++ b/src/Combinator.php @@ -12,13 +12,11 @@ /** * Class Combinator. - * - * @psalm-immutable */ abstract class Combinator implements CombinatorInterface { /** - * @return Closure + * @psalm-pure */ public static function with(): Closure { diff --git a/src/Combinator/A.php b/src/Combinator/A.php index 565fc25..f09a420 100644 --- a/src/Combinator/A.php +++ b/src/Combinator/A.php @@ -10,35 +10,26 @@ /** * Class A. * - * @psalm-template AType - * @psalm-template BType - * - * @psalm-immutable + * @template AType + * @template BType */ final class A extends Combinator { /** - * @psalm-var callable(AType): BType - * - * @var callable + * @var callable(AType): BType */ private $f; /** - * @psalm-var AType - * - * @var mixed + * @var AType */ private $x; /** * A constructor. * - * @psalm-param callable(AType): BType $f - * @psalm-param AType $x - * - * @param callable $f - * @param mixed $x + * @param callable(AType): BType $f + * @param AType $x */ public function __construct(callable $f, $x) { @@ -47,7 +38,7 @@ public function __construct(callable $f, $x) } /** - * @psalm-return BType + * @return BType */ public function __invoke() { diff --git a/src/Combinator/B.php b/src/Combinator/B.php index 573d72c..880f62b 100644 --- a/src/Combinator/B.php +++ b/src/Combinator/B.php @@ -10,45 +10,33 @@ /** * Class B. * - * @psalm-template AType - * @psalm-template BType - * @psalm-template CType - * - * @psalm-immutable + * @template AType + * @template BType + * @template CType */ final class B extends Combinator { /** - * @psalm-var callable(AType): BType - * - * @var callable + * @var callable(AType): BType */ private $f; /** - * @psalm-var callable(CType): AType - * - * @var callable + * @var callable(CType): AType */ private $g; /** - * @psalm-var CType - * - * @var mixed + * @var CType */ private $x; /** * B constructor. * - * @psalm-param callable(AType): BType $f - * @psalm-param callable(CType): AType $g - * @psalm-param CType $x - * - * @param callable $f - * @param callable $g - * @param mixed $x + * @param callable(AType): BType $f + * @param callable(CType): AType $g + * @param CType $x */ public function __construct(callable $f, callable $g, $x) { @@ -58,7 +46,7 @@ public function __construct(callable $f, callable $g, $x) } /** - * @psalm-return BType + * @return BType */ public function __invoke() { @@ -66,20 +54,29 @@ public function __invoke() } /** - * @template AParam - * @template AReturn + * @template NewAType + * @template NewBType + * @template NewCType * - * @param callable(AParam): AReturn $f + * @param callable(NewAType): (NewBType) $f * - * @return Closure(callable(mixed): AParam): Closure(mixed): AReturn + * @return Closure(Closure(NewCType):(NewAType)):(Closure(NewCType):(NewBType)) */ public static function on(callable $f): Closure { return - /** @param callable(mixed): AParam $g */ + /** + * @param callable(NewCType):(NewAType) $g + * + * @return Closure(NewCType):(NewBType) + */ static function (callable $g) use ($f): Closure { return - /** @param mixed $x */ + /** + * @param NewCType $x + * + * @return NewBType + */ static function ($x) use ($f, $g) { return (new self($f, $g, $x))(); }; diff --git a/src/Combinator/C.php b/src/Combinator/C.php index 3235a4d..61fffdf 100644 --- a/src/Combinator/C.php +++ b/src/Combinator/C.php @@ -10,45 +10,33 @@ /** * Class C. * - * @psalm-template AType - * @psalm-template BType - * @psalm-template CType - * - * @psalm-immutable + * @template AType + * @template BType + * @template CType */ final class C extends Combinator { /** - * @psalm-var callable(AType): callable(BType): CType - * - * @var callable + * @var callable(AType): callable(BType): CType */ private $f; /** - * @psalm-var BType - * - * @var mixed + * @var BType */ private $x; /** - * @psalm-var AType - * - * @var mixed + * @var AType */ private $y; /** * C constructor. * - * @psalm-param callable(AType): callable(BType): CType $f - * @psalm-param BType $x - * @psalm-param AType $y - * - * @param callable $f - * @param mixed $x - * @param mixed $y + * @param callable(AType): (callable(BType): (CType)) $f + * @param BType $x + * @param AType $y */ public function __construct(callable $f, $x, $y) { @@ -58,9 +46,7 @@ public function __construct(callable $f, $x, $y) } /** - * @psalm-return CType - * - * @return mixed + * @return CType */ public function __invoke() { @@ -72,19 +58,25 @@ public function __invoke() * @template NewBType * @template NewCType * - * @psalm-param callable(NewAType): callable(NewBType): NewCType $f - * - * @param callable(NewAType): NewCType $f + * @param callable(NewAType): (callable(NewBType): (NewCType)) $f * - * @return Closure(NewBType): Closure(NewAType): NewCType + * @return Closure(NewBType):(Closure(NewAType):(NewCType)) */ public static function on(callable $f): Closure { return - /** @param NewBType $x */ + /** + * @param NewBType $x + * + * @return Closure(NewAType):(NewCType) + */ static function ($x) use ($f): Closure { return - /** @param NewAType $y */ + /** + * @param NewAType $y + * + * @return NewCType + */ static function ($y) use ($f, $x) { return (new self($f, $x, $y))(); }; diff --git a/src/Combinator/D.php b/src/Combinator/D.php index 46775ac..ddc607f 100644 --- a/src/Combinator/D.php +++ b/src/Combinator/D.php @@ -10,70 +10,55 @@ /** * Class D. * - * @psalm-template AType - * @psalm-template BType - * @psalm-template CType - * @psalm-template DType - * - * @psalm-immutable + * @template AType + * @template BType + * @template CType + * @template DType */ final class D extends Combinator { /** - * @psalm-var callable(AType): callable(CType): DType - * - * @var callable + * @var callable(AType): callable(CType): DType */ - private $a; + private $f; /** - * @psalm-var AType - * - * @var mixed + * @var callable(BType): CType */ - private $b; + private $g; /** - * @psalm-var callable(BType): CType - * - * @var callable + * @var AType */ - private $c; + private $x; /** - * @psalm-var BType - * - * @var mixed + * @var BType */ - private $d; + private $y; /** * D constructor. * - * @psalm-param callable(AType): callable(CType): DType $a - * @psalm-param AType $b - * @psalm-param callable(BType): CType $c - * @psalm-param BType $d - * - * @param callable $a - * @param mixed $b - * @param callable $c - * @param mixed $d + * @param callable(AType): (callable(CType): (DType)) $f + * @param AType $x + * @param callable(BType): CType $g + * @param BType $y */ - public function __construct(callable $a, $b, callable $c, $d) + public function __construct(callable $f, $x, callable $g, $y) { - $this->a = $a; - $this->b = $b; - $this->c = $c; - $this->d = $d; + $this->f = $f; + $this->x = $x; + $this->g = $g; + $this->y = $y; } /** - * @psalm-return DType + * @return DType */ public function __invoke() { - return (($this->a)($this->b))(($this->c)($this->d)); + return (($this->f)($this->x))(($this->g)($this->y)); } /** @@ -82,22 +67,30 @@ public function __invoke() * @template NewCType * @template NewDType * - * @psalm-param callable(NewAType): callable(NewCType): NewDType $f - * - * @param callable(NewCType): NewDType $f - * - * @return Closure(NewAType): Closure(Closure(NewBType): NewCType): Closure(NewBType): NewDType + * @param callable(NewAType): (Closure(NewCType): (NewDType)) $f */ public static function on(callable $f): Closure { return - /** @param NewAType $x */ + /** + * @param NewAType $x + * + * @return Closure(callable(NewBType): (NewCType)): (Closure(NewBType): (NewDType)) + */ static function ($x) use ($f): Closure { return - /** @param callable(NewBType): NewCType $g */ + /** + * @param callable(NewBType): (NewCType) $g + * + * @return Closure(NewBType): (NewDType) + */ static function (callable $g) use ($f, $x): Closure { return - /** @param NewBType $y */ + /** + * @param NewBType $y + * + * @return NewDType + */ static function ($y) use ($f, $x, $g) { return (new self($f, $x, $g, $y))(); }; diff --git a/src/Combinator/E.php b/src/Combinator/E.php index b6647d1..cbf0a8e 100644 --- a/src/Combinator/E.php +++ b/src/Combinator/E.php @@ -10,67 +10,49 @@ /** * Class E. * - * @psalm-template AType - * @psalm-template BType - * @psalm-template CType - * @psalm-template DType - * @psalm-template EType - * - * @psalm-immutable + * @template AType + * @template BType + * @template CType + * @template DType + * @template EType * * phpcs:disable Generic.Files.LineLength.TooLong */ final class E extends Combinator { /** - * @psalm-var callable(AType): callable(DType): EType - * - * @var callable + * @var callable(AType): callable(DType): EType */ private $f; /** - * @psalm-var callable(BType): callable(CType): DType - * - * @var callable + * @var callable(BType): callable(CType): DType */ private $g; /** - * @psalm-var AType - * - * @var mixed + * @var AType */ private $x; /** - * @psalm-var BType - * - * @var mixed + * @var BType */ private $y; /** - * @psalm-var CType - * - * @var mixed + * @var CType */ private $z; /** * E constructor. * - * @psalm-param callable(AType): callable(DType): EType $f - * @psalm-param AType $x - * @psalm-param callable(BType): callable(CType): DType $g - * @psalm-param BType $y - * @psalm-param CType $z - * - * @param callable $f - * @param mixed $x - * @param callable $g - * @param mixed $y - * @param mixed $z + * @param callable(AType): (callable(DType): (EType)) $f + * @param AType $x + * @param callable(BType): (callable(CType): (DType)) $g + * @param BType $y + * @param CType $z */ public function __construct(callable $f, $x, callable $g, $y, $z) { @@ -82,7 +64,7 @@ public function __construct(callable $f, $x, callable $g, $y, $z) } /** - * @psalm-return EType + * @return EType */ public function __invoke() { @@ -96,27 +78,39 @@ public function __invoke() * @template NewDType * @template NewEType * - * @psalm-param callable(NewAType): callable(NewDType): NewEType $f - * - * @param callable $f - * - * @psalm-return Closure(NewAType): Closure(callable(NewBType): callable(NewCType): NewDType): Closure(NewBType): Closure(NewCType) + * @param callable(NewAType): (callable(NewDType): (NewEType)) $f * - * @return Closure + * @return Closure(NewAType):(Closure(callable(NewBType): (callable(NewCType): (NewDType))):(Closure(NewBType):(Closure(NewCType):(NewEType)))) */ public static function on(callable $f): Closure { return - /** @param NewAType $x */ + /** + * @param NewAType $x + * + * @return Closure(callable(NewBType): callable(NewCType): NewDType):(Closure(NewBType):(Closure(NewCType):(NewEType))) + */ static function ($x) use ($f): Closure { return - /** @psalm-param callable(NewBType): callable(NewCType): NewDType $g */ + /** + * @param callable(NewBType): (callable(NewCType): (NewDType)) $g + * + * @return Closure(NewBType): (Closure(NewCType):(NewEType)) + */ static function (callable $g) use ($f, $x): Closure { return - /** @param NewBType $y */ + /** + * @param NewBType $y + * + * @return Closure(NewCType):(NewEType) + */ static function ($y) use ($f, $x, $g): Closure { return - /** @param NewCType $z */ + /** + * @param NewCType $z + * + * @return NewEType + */ static function ($z) use ($f, $x, $g, $y) { return (new self($f, $x, $g, $y, $z))(); }; diff --git a/src/Combinator/F.php b/src/Combinator/F.php index ac24701..1d6e897 100644 --- a/src/Combinator/F.php +++ b/src/Combinator/F.php @@ -10,45 +10,33 @@ /** * Class F. * - * @psalm-template AType - * @psalm-template BType - * @psalm-template CType - * - * @psalm-immutable + * @template AType + * @template BType + * @template CType */ final class F extends Combinator { /** - * @psalm-var callable(BType): callable(AType): CType - * - * @var callable + * @var callable(BType): (Closure(AType): (CType)) */ private $f; /** - * @psalm-var AType - * - * @var mixed + * @var AType */ private $x; /** - * @psalm-var BType - * - * @var mixed + * @var BType */ private $y; /** * F constructor. * - * @psalm-param AType $x - * @psalm-param BType $y - * @psalm-param callable(BType): callable(AType): CType $f - * - * @param mixed $x - * @param mixed $y - * @param callable $f + * @param AType $x + * @param BType $y + * @param callable(BType): (Closure(AType): (CType)) $f */ public function __construct($x, $y, callable $f) { @@ -58,7 +46,7 @@ public function __construct($x, $y, callable $f) } /** - * @psalm-return CType + * @return CType */ public function __invoke() { @@ -70,19 +58,25 @@ public function __invoke() * @template NewBType * @template NewCType * - * @psalm-param NewAType $a - * - * @param mixed $a + * @param NewAType $a * - * @return Closure(NewBType): Closure(callable(NewBType): callable(NewAType): NewCType): NewCType + * @return Closure(NewBType):(Closure(callable(NewBType): (Closure(NewAType): (NewCType))):(NewCType)) */ public static function on($a): Closure { return - /** @param NewBType $b */ + /** + * @param NewBType $b + * + * @return Closure(callable(NewBType): (Closure(NewAType): (NewCType))):(NewCType) + */ static function ($b) use ($a): Closure { return - /** @psalm-param callable(NewBType): callable(NewAType): NewCType $c */ + /** + * @param callable(NewBType): (Closure(NewAType): (NewCType)) $c + * + * @return NewCType + */ static function (callable $c) use ($a, $b) { return (new self($a, $b, $c))(); }; diff --git a/src/Combinator/G.php b/src/Combinator/G.php index 263d468..943c522 100644 --- a/src/Combinator/G.php +++ b/src/Combinator/G.php @@ -10,55 +10,40 @@ /** * Class G. * - * @psalm-template AType - * @psalm-template BType - * @psalm-template CType - * @psalm-template DType - * - * @psalm-immutable + * @template AType + * @template BType + * @template CType + * @template DType */ final class G extends Combinator { /** - * @psalm-var callable(AType): callable(BType): CType - * - * @var callable + * @var callable(AType): (callable(BType): (CType)) */ private $f; /** - * @psalm-var callable(DType): BType - * - * @var callable + * @var callable(DType): BType */ private $g; /** - * @psalm-var DType - * - * @var mixed + * @var DType */ private $x; /** - * @psalm-var AType - * - * @var mixed + * @var AType */ private $y; /** * G constructor. * - * @psalm-param callable(AType): callable(BType): CType $f - * @psalm-param callable(DType): BType $g - * @psalm-param DType $x - * @psalm-param AType $y - * - * @param callable $f - * @param callable $g - * @param mixed $x - * @param mixed $y + * @param callable(AType): (callable(BType): (CType)) $f + * @param callable(DType): (BType) $g + * @param DType $x + * @param AType $y */ public function __construct(callable $f, callable $g, $x, $y) { @@ -69,7 +54,7 @@ public function __construct(callable $f, callable $g, $x, $y) } /** - * @psalm-return CType + * @return CType */ public function __invoke() { @@ -82,22 +67,32 @@ public function __invoke() * @template NewCType * @template NewDType * - * @psalm-param callable(NewAType): callable(NewBType): NewCType $f - * - * @param callable $f + * @param callable(NewAType): (callable(NewBType): (NewCType)) $f * - * @return Closure(callable(NewDType): NewBType): Closure(NewDType): Closure(NewAType): NewCType + * @return Closure(callable(NewDType): (NewBType)):(Closure(NewDType):(Closure(NewAType):(NewCType))) */ public static function on(callable $f): Closure { return - /** @param callable(NewDType): NewBType $g */ + /** + * @param callable(NewDType): (NewBType) $g + * + * @return Closure(NewDType):(Closure(NewAType):(NewCType)) + */ static function (callable $g) use ($f): Closure { return - /** @param NewDType $x */ + /** + * @param NewDType $x + * + * @return Closure(NewAType):(NewCType) + */ static function ($x) use ($f, $g): Closure { return - /** @param NewAType $y */ + /** + * @param NewAType $y + * + * @return NewCType + */ static function ($y) use ($f, $g, $x) { return (new self($f, $g, $x, $y))(); }; diff --git a/src/Combinator/H.php b/src/Combinator/H.php index 7139967..be8de48 100644 --- a/src/Combinator/H.php +++ b/src/Combinator/H.php @@ -10,45 +10,33 @@ /** * Class H. * - * @psalm-template AType - * @psalm-template BType - * @psalm-template CType - * - * @psalm-immutable + * @template AType + * @template BType + * @template CType */ final class H extends Combinator { /** - * @psalm-var callable(AType): callable(BType): callable(AType): CType - * - * @var callable + * @var callable(AType): (Closure(BType): (Closure(AType): (CType))) */ private $f; /** - * @psalm-var AType - * - * @var mixed + * @var AType */ private $x; /** - * @psalm-var BType - * - * @var mixed + * @var BType */ private $y; /** * H constructor. * - * @psalm-param callable(AType): callable(BType): callable(AType): CType $f - * @psalm-param AType $x - * @psalm-param BType $y - * - * @param callable $f - * @param mixed $x - * @param mixed $y + * @param callable(AType): (Closure(BType): (Closure(AType): (CType))) $f + * @param AType $x + * @param BType $y */ public function __construct(callable $f, $x, $y) { @@ -58,7 +46,7 @@ public function __construct(callable $f, $x, $y) } /** - * @psalm-return CType + * @return CType */ public function __invoke() { @@ -70,19 +58,25 @@ public function __invoke() * @template NewBType * @template NewCType * - * @psalm-param callable(NewAType): callable(NewBType): callable(NewAType): NewCType $f - * - * @param callable $f + * @param callable(NewAType): (Closure(NewBType): (Closure(NewAType): (NewCType))) $f * - * @return Closure(NewAType): Closure(NewBType): NewCType + * @return Closure(NewAType):(Closure(NewBType):(NewCType)) */ public static function on(callable $f): Closure { return - /** @param NewAType $x */ + /** + * @param NewAType $x + * + * @return Closure(NewBType):(NewCType) + */ static function ($x) use ($f): Closure { return - /** @param NewBType $y */ + /** + * @param NewBType $y + * + * @return NewCType + */ static function ($y) use ($f, $x) { return (new self($f, $x, $y))(); }; diff --git a/src/Combinator/I.php b/src/Combinator/I.php index 7bb99ca..17662f3 100644 --- a/src/Combinator/I.php +++ b/src/Combinator/I.php @@ -9,25 +9,19 @@ /** * Class I. * - * @psalm-template AType - * - * @psalm-immutable + * @template AType */ final class I extends Combinator { /** - * @psalm-var AType - * - * @var mixed + * @var AType */ private $x; /** * I constructor. * - * @psalm-param AType $x - * - * @param mixed $x + * @param AType $x */ public function __construct($x) { @@ -35,7 +29,7 @@ public function __construct($x) } /** - * @psalm-return AType + * @return AType */ public function __invoke() { @@ -45,9 +39,7 @@ public function __invoke() /** * @template NewAType * - * @psalm-param NewAType $x - * - * @param mixed $x + * @param NewAType $x * * @return NewAType */ diff --git a/src/Combinator/J.php b/src/Combinator/J.php index 66368e3..c335c9e 100644 --- a/src/Combinator/J.php +++ b/src/Combinator/J.php @@ -10,53 +10,38 @@ /** * Class J. * - * @psalm-template AType - * @psalm-template BType - * - * @psalm-immutable + * @template AType + * @template BType */ final class J extends Combinator { /** - * @psalm-var callable(AType): callable(BType): BType - * - * @var callable + * @var callable(AType): (callable(BType): (BType)) */ private $f; /** - * @psalm-var AType - * - * @var mixed + * @var AType */ private $x; /** - * @psalm-var BType - * - * @var mixed + * @var BType */ private $y; /** - * @psalm-var AType - * - * @var mixed + * @var AType */ private $z; /** * J constructor. * - * @psalm-param callable(AType): callable(BType): BType $f - * @psalm-param AType $x - * @psalm-param BType $y - * @psalm-param AType $z - * - * @param callable $f - * @param mixed $x - * @param mixed $y - * @param mixed $z + * @param callable(AType): (callable(BType): (BType)) $f + * @param AType $x + * @param BType $y + * @param AType $z */ public function __construct(callable $f, $x, $y, $z) { @@ -67,7 +52,7 @@ public function __construct(callable $f, $x, $y, $z) } /** - * @psalm-return BType + * @return BType */ public function __invoke() { @@ -78,24 +63,32 @@ public function __invoke() * @template NewAType * @template NewBType * - * @psalm-param callable(NewAType): callable(NewBType): NewBType $f - * - * @param callable $f - * - * @psalm-return Closure(NewAType): Closure(NewBType): Closure(NewAType): NewBType + * @param callable(NewAType): (callable(NewBType): (NewBType)) $f * - * @return NewBType + * @return Closure(NewAType):(Closure(NewBType):(Closure(NewAType):(NewBType))) */ public static function on(callable $f): Closure { return - /** @param NewAType $x */ + /** + * @param NewAType $x + * + * @return Closure(NewBType):(Closure(NewAType):(NewBType)) + */ static function ($x) use ($f): Closure { return - /** @param NewBType $y */ + /** + * @param NewBType $y + * + * @return Closure(NewAType):(NewBType) + */ static function ($y) use ($f, $x): Closure { return - /** @param NewAType $z */ + /** + * @param NewAType $z + * + * @return NewBType + */ static function ($z) use ($f, $x, $y) { return (new self($f, $x, $y, $z))(); }; diff --git a/src/Combinator/K.php b/src/Combinator/K.php index cdcbd40..8467292 100644 --- a/src/Combinator/K.php +++ b/src/Combinator/K.php @@ -10,35 +10,26 @@ /** * Class K. * - * @psalm-template AType - * @psalm-template BType - * - * @psalm-immutable + * @template AType + * @template BType */ final class K extends Combinator { /** - * @psalm-var AType - * - * @var mixed + * @var AType */ private $x; /** - * @psalm-var BType - * - * @var mixed + * @var BType */ private $y; /** * K constructor. * - * @psalm-param AType $x - * @psalm-param BType $y - * - * @param mixed $x - * @param mixed $y + * @param AType $x + * @param BType $y */ public function __construct($x, $y) { @@ -47,9 +38,7 @@ public function __construct($x, $y) } /** - * @psalm-return AType - * - * @return mixed + * @return AType */ public function __invoke() { @@ -60,16 +49,16 @@ public function __invoke() * @template NewAType * @template NewBType * - * @psalm-param NewAType $x - * - * @param mixed $x + * @param NewAType $x * * @return Closure(NewBType): NewAType */ public static function on($x): Closure { return - /** @param NewBType $y */ + /** + * @param NewBType $y + */ static function ($y) use ($x) { return (new self($x, $y))(); }; diff --git a/src/Combinator/Ki.php b/src/Combinator/Ki.php index d506cf2..50c763c 100644 --- a/src/Combinator/Ki.php +++ b/src/Combinator/Ki.php @@ -10,35 +10,26 @@ /** * Class Ki. * - * @psalm-template AType - * @psalm-template BType - * - * @psalm-immutable + * @template AType + * @template BType */ final class Ki extends Combinator { /** - * @psalm-var AType - * - * @var mixed + * @var AType */ private $x; /** - * @psalm-var BType - * - * @var mixed + * @var BType */ private $y; /** * Ki constructor. * - * @psalm-param AType $x - * @psalm-param BType $y - * - * @param mixed $x - * @param mixed $y + * @param AType $x + * @param BType $y */ public function __construct($x, $y) { @@ -47,7 +38,7 @@ public function __construct($x, $y) } /** - * @psalm-return BType + * @return BType */ public function __invoke() { @@ -58,16 +49,16 @@ public function __invoke() * @template NewAType * @template NewBType * - * @psalm-param NewAType $x - * - * @param mixed $x + * @param NewAType $x * * @return Closure(NewBType): NewBType */ public static function on($x): Closure { return - /** @param NewBType $y */ + /** + * @param NewBType $y + */ static function ($y) use ($x) { return (new self($x, $y))(); }; diff --git a/src/Combinator/L.php b/src/Combinator/L.php index 853941e..932e657 100644 --- a/src/Combinator/L.php +++ b/src/Combinator/L.php @@ -9,8 +9,6 @@ /** * Class L. - * - * @psalm-immutable */ final class L extends Combinator { @@ -26,9 +24,6 @@ final class L extends Combinator /** * L constructor. - * - * @param callable $f - * @param callable $g */ public function __construct(callable $f, callable $g) { @@ -46,10 +41,6 @@ public function __invoke() /** * @psalm-suppress MissingClosureReturnType - * - * @param callable $a - * - * @return Closure */ public static function on(callable $a): Closure { diff --git a/src/Combinator/M.php b/src/Combinator/M.php index 87b8225..bda0daf 100644 --- a/src/Combinator/M.php +++ b/src/Combinator/M.php @@ -8,8 +8,6 @@ /** * Class M. - * - * @psalm-immutable */ final class M extends Combinator { @@ -20,10 +18,6 @@ final class M extends Combinator /** * M constructor. - * - * @psalm-param callable $f - * - * @param callable $f */ public function __construct(callable $f) { @@ -39,8 +33,6 @@ public function __invoke() } /** - * @param callable $a - * * @return mixed */ public static function on(callable $a) diff --git a/src/Combinator/O.php b/src/Combinator/O.php index f84c9fa..1a8c570 100644 --- a/src/Combinator/O.php +++ b/src/Combinator/O.php @@ -10,35 +10,26 @@ /** * Class O. * - * @psalm-template AType - * @psalm-template BType - * - * @psalm-immutable + * @template AType + * @template BType */ final class O extends Combinator { /** - * @psalm-var callable(callable(AType): BType): AType - * - * @var callable + * @var callable(callable(AType): BType): AType */ private $f; /** - * @psalm-var callable(AType): BType - * - * @var callable + * @var callable(AType): BType */ private $g; /** * O constructor. * - * @psalm-param callable(callable(AType): BType): AType $f - * @psalm-param callable(AType): BType $g - * - * @param callable(callable(AType): BType): AType $f - * @param callable(AType): BType $g + * @param callable(callable(AType): (BType)): (AType) $f + * @param callable(AType): (BType) $g */ public function __construct(callable $f, callable $g) { @@ -47,7 +38,7 @@ public function __construct(callable $f, callable $g) } /** - * @psalm-return BType + * @return BType */ public function __invoke() { @@ -58,18 +49,18 @@ public function __invoke() * @template NewAType * @template NewBType * - * @psalm-param callable(callable(NewAType): NewBType): NewAType $f - * - * @param callable $f - * - * @psalm-return Closure(callable(NewAType): NewBType): NewBType + * @param callable(callable(NewAType): (NewBType)): (NewAType) $f * - * @return Closure + * @return Closure(callable(NewAType): (NewBType)): (NewBType) */ public static function on(callable $f): Closure { return - /** @param callable(NewAType): NewBType $g */ + /** + * @param callable(NewAType): (NewBType) $g + * + * @return NewBType + */ static function (callable $g) use ($f) { return (new self($f, $g))(); }; diff --git a/src/Combinator/Omega.php b/src/Combinator/Omega.php index ef4e6ce..0dfb4f4 100644 --- a/src/Combinator/Omega.php +++ b/src/Combinator/Omega.php @@ -4,13 +4,10 @@ namespace loophp\combinator\Combinator; -use Closure; use loophp\combinator\Combinator; /** * Class Omega. - * - * @psalm-immutable */ final class Omega extends Combinator { @@ -21,8 +18,6 @@ final class Omega extends Combinator /** * Omega constructor. - * - * @param callable $f */ public function __construct(callable $f) { @@ -42,8 +37,6 @@ public function __invoke() } /** - * @param callable $f - * * @return mixed */ public static function on(callable $f) diff --git a/src/Combinator/Phoenix.php b/src/Combinator/Phoenix.php index defc451..77462d0 100644 --- a/src/Combinator/Phoenix.php +++ b/src/Combinator/Phoenix.php @@ -10,57 +10,42 @@ /** * Class Phoenix. * - * @psalm-template AType - * @psalm-template BType - * @psalm-template CType - * @psalm-template DType - * - * @psalm-immutable + * @template AType + * @template BType + * @template CType + * @template DType * * phpcs:disable Generic.Files.LineLength.TooLong */ final class Phoenix extends Combinator { /** - * @psalm-var callable(AType): callable(BType): CType - * - * @var callable + * @var callable(AType): (callable(BType): (CType)) */ private $f; /** - * @psalm-var callable(DType): AType - * - * @var callable + * @var callable(DType): AType */ private $g; /** - * @psalm-var callable(DType): BType - * - * @var callable + * @var callable(DType): BType */ private $h; /** - * @psalm-var DType - * - * @var mixed + * @var DType */ private $x; /** * Phoenix constructor. * - * @psalm-param callable(AType): callable(BType): CType $f - * @psalm-param callable(DType): AType $g - * @psalm-param callable(DType): BType $h - * @psalm-param DType $x - * - * @param callable $f - * @param callable $g - * @param callable $h - * @param mixed $x + * @param callable(AType): (callable(BType): (CType)) $f + * @param callable(DType): (AType) $g + * @param callable(DType): (BType) $h + * @param DType $x */ public function __construct(callable $f, callable $g, callable $h, $x) { @@ -71,7 +56,7 @@ public function __construct(callable $f, callable $g, callable $h, $x) } /** - * @psalm-return CType + * @return CType */ public function __invoke() { @@ -84,24 +69,30 @@ public function __invoke() * @template NewCType * @template NewDType * - * @psalm-param callable(NewAType): callable(NewBType): NewCType $f - * - * @param callable $f - * - * @psalm-return Closure(callable(NewDType): NewAType): Closure(callable(NewDType): NewBType): Closure(NewDType): NewCType - * - * @return Closure + * @param callable(NewAType): (callable(NewBType): (NewCType)) $f */ public static function on(callable $f): Closure { return - /** @psalm-param callable(NewDType): NewAType $g */ + /** + * @param callable(NewDType): (NewAType) $g + * + * @return Closure(callable(NewDType): (NewBType)):(Closure(NewDType):(NewCType)) + */ static function (callable $g) use ($f): Closure { return - /** @psalm-param callable(NewDType): NewBType $h */ + /** + * @param callable(NewDType): (NewBType) $h + * + * @return Closure(NewDType):(NewCType) + */ static function (callable $h) use ($f, $g): Closure { return - /** @psalm-param NewDType $x */ + /** + * @param NewDType $x + * + * @return NewCType + */ static function ($x) use ($f, $g, $h) { return (new self($f, $g, $h, $x))(); }; diff --git a/src/Combinator/Psi.php b/src/Combinator/Psi.php index 82d905f..a5707fe 100644 --- a/src/Combinator/Psi.php +++ b/src/Combinator/Psi.php @@ -13,49 +13,37 @@ * @psalm-template AType * @psalm-template BType * @psalm-template CType - * - * @psalm-immutable */ final class Psi extends Combinator { /** - * @psalm-var callable(AType): callable(AType): BType - * - * @var callable + * @var callable(AType):(callable(AType):(BType)) */ private $f; /** - * @psalm-var callable(CType): AType - * - * @var callable + * @var callable(CType):(AType) */ private $g; /** - * @psalm-var CType - * - * @var mixed + * @var CType */ private $x; /** - * @psalm-var CType - * - * @var mixed + * @var CType */ private $y; /** * Psi constructor. * - * @psalm-param callable(AType): callable(AType): BType $f - * @psalm-param callable(CType): AType $g + * @psalm-param callable(AType): (callable(AType): (BType)) $f + * @psalm-param callable(CType): (AType) $g * @psalm-param CType $x * @psalm-param CType $y * - * @param callable $f - * @param callable $g * @param mixed $x * @param mixed $y */ @@ -68,7 +56,7 @@ public function __construct(callable $f, callable $g, $x, $y) } /** - * @psalm-return BType + * @return BType */ public function __invoke() { @@ -80,24 +68,28 @@ public function __invoke() * @template NewBType * @template NewCType * - * @psalm-param callable(NewAType): callable(NewAType): NewBType $f - * - * @param callable $f - * - * @psalm-return Closure(callable(NewCType): NewAType): Closure(NewCType): Closure(NewCType): NewBType - * - * @return Closure + * @param callable(NewAType): (callable(NewAType): (NewBType)) $f */ public static function on(callable $f): Closure { return - /** @psalm-param callable(NewCType): NewAType $g */ + /** + * @psalm-param callable(NewCType): NewAType $g + */ static function (callable $g) use ($f): Closure { return - /** @psalm-param NewCType $x */ + /** + * @psalm-param NewCType $x + * + * @param mixed $x + */ static function ($x) use ($f, $g): Closure { return - /** @psalm-param NewCType $y */ + /** + * @psalm-param NewCType $y + * + * @param mixed $y + */ static function ($y) use ($f, $g, $x) { return (new self($f, $g, $x, $y))(); }; diff --git a/src/Combinator/Q.php b/src/Combinator/Q.php index f0cc467..dc64d13 100644 --- a/src/Combinator/Q.php +++ b/src/Combinator/Q.php @@ -10,45 +10,33 @@ /** * Class Q. * - * @psalm-template AType - * @psalm-template BType - * @psalm-template CType - * - * @psalm-immutable + * @template AType + * @template BType + * @template CType */ final class Q extends Combinator { /** - * @psalm-var callable(AType): BType - * - * @var callable + * @var callable(AType): BType */ private $f; /** - * @psalm-var callable(BType): CType - * - * @var callable + * @var callable(BType): CType */ private $g; /** - * @psalm-var AType - * - * @var mixed + * @var AType */ private $x; /** * Q constructor. * - * @psalm-param callable(AType): BType $f - * @psalm-param callable(BType): CType $g - * @psalm-param AType $x - * - * @param callable $f - * @param callable $g - * @param mixed $x + * @param callable(AType): BType $f + * @param callable(BType): CType $g + * @param AType $x */ public function __construct(callable $f, callable $g, $x) { @@ -58,7 +46,7 @@ public function __construct(callable $f, callable $g, $x) } /** - * @psalm-return CType + * @return CType */ public function __invoke() { @@ -70,21 +58,21 @@ public function __invoke() * @template NewBType * @template NewCType * - * @psalm-param callable(NewAType): NewBType $f - * - * @param callable $f - * - * @psalm-return Closure(callable(NewBType): NewCType): Closure(NewAType): NewCType - * - * @return Closure + * @param callable(NewAType): (NewBType) $f */ public static function on(callable $f): Closure { return - /** @psalm-param callable(NewBType): NewCType $g */ + /** + * @param callable(NewBType): NewCType $g + * + * @return \Closure(NewAType):(NewCType) + */ static function (callable $g) use ($f): Closure { return - /** @psalm-param NewAType $x */ + /** + * @param NewAType $x + */ static function ($x) use ($f, $g) { return (new self($f, $g, $x))(); }; diff --git a/src/Combinator/R.php b/src/Combinator/R.php index 595cda7..654570b 100644 --- a/src/Combinator/R.php +++ b/src/Combinator/R.php @@ -10,45 +10,33 @@ /** * Class R. * - * @psalm-template AType - * @psalm-template BType - * @psalm-template CType - * - * @psalm-immutable + * @template AType + * @template BType + * @template CType */ final class R extends Combinator { /** - * @psalm-var callable(BType): callable(AType): CType - * - * @var callable + * @var callable(BType):(Closure(AType):(CType)) */ private $f; /** - * @psalm-var AType - * - * @var mixed + * @var AType */ private $x; /** - * @psalm-var BType - * - * @var mixed + * @var BType */ private $y; /** * R constructor. * - * @psalm-param AType $x - * @psalm-param callable(BType): callable(AType): CType $f - * @psalm-param BType $y - * - * @param mixed $x - * @param callable $f - * @param mixed $y + * @param AType $x + * @param callable(BType):(Closure(AType):(CType)) $f + * @param BType $y */ public function __construct($x, callable $f, $y) { @@ -58,7 +46,7 @@ public function __construct($x, callable $f, $y) } /** - * @psalm-return CType + * @return CType */ public function __invoke() { @@ -70,21 +58,25 @@ public function __invoke() * @template NewBType * @template NewCType * - * @psalm-param NewAType $x - * * @param NewAType $x * - * @psalm-return Closure(callable(NewBType): callable(NewAType): NewCType): Closure(NewBType): NewCType - * - * @return Closure + * @return Closure(callable(NewBType):(Closure(NewAType):(NewCType))):(Closure(NewBType):(NewCType)) */ public static function on($x): Closure { return - /** @psalm-param callable(NewBType): callable(NewAType): NewCType $f */ + /** + * @param callable(NewBType):(Closure(NewAType):(NewCType)) $f + * + * @return Closure(NewBType):(NewCType) + */ static function (callable $f) use ($x): Closure { return - /** @psalm-param NewBType $y */ + /** + * @param NewBType $y + * + * @return NewCType + */ static function ($y) use ($x, $f) { return (new self($x, $f, $y))(); }; diff --git a/src/Combinator/S.php b/src/Combinator/S.php index 8daf6c2..0398b94 100644 --- a/src/Combinator/S.php +++ b/src/Combinator/S.php @@ -10,45 +10,33 @@ /** * Class S. * - * @psalm-template AType - * @psalm-template BType - * @psalm-template CType - * - * @psalm-immutable + * @template AType + * @template BType + * @template CType */ final class S extends Combinator { /** - * @psalm-var callable(AType): callable(BType): CType - * - * @var callable + * @var callable(AType):(callable(BType):(CType)) */ private $f; /** - * @psalm-var callable(AType): BType - * - * @var callable + * @var callable(AType):(BType) */ private $g; /** - * @psalm-var AType - * - * @var mixed + * @var AType */ 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 + * @param callable(AType):(callable(BType):(CType)) $f + * @param callable(AType):(BType) $g + * @param AType $x */ public function __construct(callable $f, callable $g, $x) { @@ -58,7 +46,7 @@ public function __construct(callable $f, callable $g, $x) } /** - * @psalm-return CType + * @return CType */ public function __invoke() { @@ -70,21 +58,23 @@ public function __invoke() * @template NewBType * @template NewCType * - * @psalm-param callable(NewAType): callable(NewBType): NewCType $f - * - * @param callable $f - * - * @psalm-return Closure(callable(NewAType): NewBType): Closure(NewAType): NewCType - * - * @return Closure + * @param callable(NewAType):(callable(NewBType):(NewCType)) $f */ public static function on(callable $f): Closure { return - /** @psalm-param callable(NewAType): NewBType $g */ + /** + * @param callable(NewAType):(NewBType) $g + * + * @return Closure(NewAType):(NewCType) + */ static function (callable $g) use ($f): Closure { return - /** @psalm-param NewAType $x */ + /** + * @param NewAType $x + * + * @return NewCType + */ static function ($x) use ($f, $g) { return (new self($f, $g, $x))(); }; diff --git a/src/Combinator/T.php b/src/Combinator/T.php index 672dc13..5474a8d 100644 --- a/src/Combinator/T.php +++ b/src/Combinator/T.php @@ -10,35 +10,26 @@ /** * Class T. * - * @psalm-template AType - * @psalm-template BType - * - * @psalm-immutable + * @template AType + * @template BType */ final class T extends Combinator { /** - * @psalm-var callable(AType): BType - * - * @var callable + * @var callable(AType): BType */ private $f; /** - * @psalm-var AType - * - * @var mixed + * @var AType */ private $x; /** * T constructor. * - * @psalm-param AType $x - * @psalm-param callable(AType): BType $f - * - * @param mixed $x - * @param callable $f + * @param AType $x + * @param callable(AType): BType $f */ public function __construct($x, callable $f) { @@ -47,7 +38,7 @@ public function __construct($x, callable $f) } /** - * @psalm-return BType + * @return BType */ public function __invoke() { @@ -58,20 +49,18 @@ public function __invoke() * @template NewAType * @template NewBType * - * @psalm-param NewAType $x - * - * @param mixed $x - * - * @psalm-return Closure(callable(NewAType): NewBType): NewBType - * - * @return Closure + * @param NewAType $x */ public static function on($x): Closure { return - /** @psalm-param callable(NewAType): NewBType $f */ + /** + * @param callable(NewAType): NewBType $f + * + * @return NewBType + */ static function (callable $f) use ($x) { - return (new self($x, $f))(); - }; + return (new self($x, $f))(); + }; } } diff --git a/src/Combinator/U.php b/src/Combinator/U.php index 1a33516..6af652a 100644 --- a/src/Combinator/U.php +++ b/src/Combinator/U.php @@ -9,15 +9,11 @@ /** * Class U. - * - * @psalm-immutable */ final class U extends Combinator { /** - * @psalm-var callable(callable): callable - * - * @var callable + * @var callable(callable): callable */ private $f; @@ -29,10 +25,7 @@ final class U extends Combinator /** * U constructor. * - * @psalm-param callable(callable): callable $f - * - * @param callable $f - * @param callable $g + * @param callable(callable): callable $f */ public function __construct(callable $f, callable $g) { @@ -52,18 +45,20 @@ public function __invoke() } /** - * @psalm-suppress MissingClosureReturnType - * @psalm-suppress MissingClosureParamType - * @psalm-suppress MixedArgumentTypeCoercion - * - * @param callable $a + * @suppress MissingClosureReturnType + * @suppress MissingClosureParamType + * @suppress MixedArgumentTypeCoercion * - * @return Closure + * @param callable(callable): callable $f */ - public static function on(callable $a): Closure + public static function on(callable $f): Closure { - return static function (callable $b) use ($a) { - return (new self($a, $b))(); - }; + return + /** + * @return mixed + */ + static function (callable $g) use ($f) { + return (new self($f, $g))(); + }; } } diff --git a/src/Combinator/V.php b/src/Combinator/V.php index c562f2c..1383771 100644 --- a/src/Combinator/V.php +++ b/src/Combinator/V.php @@ -10,45 +10,33 @@ /** * Class V. * - * @psalm-template AType - * @psalm-template BType - * @psalm-template CType - * - * @psalm-immutable + * @template AType + * @template BType + * @template CType */ final class V extends Combinator { /** - * @psalm-var callable(AType): callable(BType): CType - * - * @var callable + * @var callable(AType): callable(BType): CType */ private $f; /** - * @psalm-var AType - * - * @var mixed + * @var AType */ private $x; /** - * @psalm-var BType - * - * @var mixed + * @var BType */ private $y; /** * V constructor. * - * @psalm-param AType $x - * @psalm-param BType $y - * @psalm-param callable(AType): callable(BType): CType $f - * - * @param mixed $x - * @param mixed $y - * @param callable $f + * @param AType $x + * @param BType $y + * @param callable(AType): (callable(BType): (CType)) $f */ public function __construct($x, $y, callable $f) { @@ -58,7 +46,7 @@ public function __construct($x, $y, callable $f) } /** - * @psalm-return CType + * @return CType */ public function __invoke() { @@ -70,21 +58,25 @@ public function __invoke() * @template NewBType * @template NewCType * - * @psalm-param NewAType $x - * - * @param mixed $x - * - * @psalm-return Closure(NewBType): Closure(callable(NewAType): callable(NewBType): NewCType): NewCType + * @param NewAType $x * - * @return Closure + * @return Closure(NewBType):(Closure(callable(NewAType): (callable(NewBType): (NewCType))):(NewCType)) */ public static function on($x): Closure { return - /** @psalm-param NewBType $y */ + /** + * @param NewBType $y + * + * @return Closure(callable(NewAType): (callable(NewBType): (NewCType))):(NewCType) + */ static function ($y) use ($x): Closure { return - /** @psalm-param callable(NewAType): callable(NewBType): NewCType $f */ + /** + * @param callable(NewAType): (callable(NewBType): (NewCType)) $f + * + * @return NewCType + */ static function (callable $f) use ($x, $y) { return (new self($x, $y, $f))(); }; diff --git a/src/Combinator/W.php b/src/Combinator/W.php index 62af4d5..c338d6f 100644 --- a/src/Combinator/W.php +++ b/src/Combinator/W.php @@ -10,35 +10,26 @@ /** * Class W. * - * @psalm-template AType - * @psalm-template BType - * - * @psalm-immutable + * @template AType + * @template BType */ final class W extends Combinator { /** - * @psalm-var callable(AType): callable(AType): BType - * - * @var callable + * @var callable(AType): callable(AType): BType */ private $f; /** - * @psalm-var AType - * - * @var mixed + * @var AType */ private $x; /** * W constructor. * - * @psalm-param callable(AType): callable(AType): BType $f - * @psalm-param AType $x - * - * @param callable $f - * @param mixed $x + * @param callable(AType): (callable(AType): (BType)) $f + * @param AType $x */ public function __construct(callable $f, $x) { @@ -47,7 +38,7 @@ public function __construct(callable $f, $x) } /** - * @psalm-return BType + * @return BType */ public function __invoke() { @@ -58,18 +49,16 @@ public function __invoke() * @template NewAType * @template NewBType * - * @psalm-param callable(NewAType): callable(NewAType): NewBType $f - * - * @param callable $f - * - * @psalm-return Closure(NewAType): NewBType - * - * @return Closure + * @param callable(NewAType):(callable(NewAType):(NewBType)) $f */ public static function on(callable $f): Closure { return - /** @psalm-param NewAType $x */ + /** + * @param NewAType $x + * + * @return NewBType + */ static function ($x) use ($f) { return (new self($f, $x))(); }; diff --git a/src/Combinator/Y.php b/src/Combinator/Y.php index f988dd8..39888bf 100644 --- a/src/Combinator/Y.php +++ b/src/Combinator/Y.php @@ -9,8 +9,6 @@ /** * Class Y. - * - * @psalm-immutable */ final class Y extends Combinator { @@ -25,8 +23,6 @@ final class Y extends Combinator * Y constructor. * * @psalm-param callable(callable): Closure $f - * - * @param callable $f */ public function __construct(callable $f) { @@ -65,10 +61,6 @@ static function (...$arguments) use ($f) { * @psalm-suppress MissingClosureReturnType * @psalm-suppress MissingClosureParamType * @psalm-suppress MixedArgumentTypeCoercion - * - * @param callable $a - * - * @return Closure */ public static function on(callable $a): Closure { diff --git a/src/Combinator/Z.php b/src/Combinator/Z.php index af6676a..42cc209 100644 --- a/src/Combinator/Z.php +++ b/src/Combinator/Z.php @@ -9,8 +9,6 @@ /** * Class Z. - * - * @psalm-immutable */ final class Z extends Combinator { @@ -23,8 +21,6 @@ final class Z extends Combinator * Z constructor. * * @psalm-param callable $f - * - * @param callable $f */ public function __construct(callable $f) { @@ -65,10 +61,6 @@ static function () use ($f) { * @psalm-suppress MissingClosureReturnType * @psalm-suppress MissingClosureParamType * @psalm-suppress MixedArgumentTypeCoercion - * - * @param callable $a - * - * @return Closure */ public static function on(callable $a): Closure { diff --git a/src/Combinators.php b/src/Combinators.php index 6f2164d..d1e01fc 100644 --- a/src/Combinators.php +++ b/src/Combinators.php @@ -40,217 +40,136 @@ */ final class Combinators { - /** - * @return Closure - */ public static function A(): Closure { return A::with(); } - /** - * @return Closure - */ public static function B(): Closure { return B::with(); } - /** - * @return Closure - */ public static function C(): Closure { return C::with(); } - /** - * @return Closure - */ public static function D(): Closure { return D::with(); } - /** - * @return Closure - */ public static function E(): Closure { return E::with(); } - /** - * @return Closure - */ public static function F(): Closure { return F::with(); } - /** - * @return Closure - */ public static function G(): Closure { return G::with(); } - /** - * @return Closure - */ public static function H(): Closure { return H::with(); } - /** - * @return Closure - */ public static function I(): Closure { return I::with(); } - /** - * @return Closure - */ public static function J(): Closure { return J::with(); } - /** - * @return Closure - */ public static function K(): Closure { return K::with(); } - /** - * @return Closure - */ public static function Ki(): Closure { return Ki::with(); } - /** - * @return Closure - */ public static function L(): Closure { return L::with(); } - /** - * @return Closure - */ public static function M(): Closure { return M::with(); } - /** - * @return Closure - */ public static function O(): Closure { return O::with(); } - /** - * @return Closure - */ public static function Omega(): Closure { return Omega::with(); } - /** - * @return Closure - */ public static function Phoenix(): Closure { return Phoenix::with(); } - /** - * @return Closure - */ public static function Psi(): Closure { return Psi::with(); } - /** - * @return Closure - */ public static function Q(): Closure { return Q::with(); } - /** - * @return Closure - */ public static function R(): Closure { return R::with(); } - /** - * @return Closure - */ public static function S(): Closure { return S::with(); } - /** - * @return Closure - */ public static function T(): Closure { return T::with(); } - /** - * @return Closure - */ public static function U(): Closure { return U::with(); } - /** - * @return Closure - */ public static function V(): Closure { return V::with(); } - /** - * @return Closure - */ public static function W(): Closure { return W::with(); } - /** - * @return Closure - */ public static function Y(): Closure { return Y::with(); } - /** - * @return Closure - */ public static function Z(): Closure { return Z::with(); diff --git a/src/Contract/Combinator.php b/src/Contract/Combinator.php index 79da03c..3df6b70 100644 --- a/src/Contract/Combinator.php +++ b/src/Contract/Combinator.php @@ -6,13 +6,7 @@ use Closure; -/** - * Interface Combinator. - */ interface Combinator { - /** - * @return Closure - */ public static function with(): Closure; } diff --git a/tests/static-analysis/F.php b/tests/static-analysis/F.php index e0b48ee..884afc7 100644 --- a/tests/static-analysis/F.php +++ b/tests/static-analysis/F.php @@ -9,7 +9,7 @@ /** * @param string $x * @param int $y - * @param callable(int): callable(string): bool $f + * @param callable(int): (Closure(string): (bool)) $f * * @return bool */ diff --git a/tests/static-analysis/H.php b/tests/static-analysis/H.php index a3c15fd..7a6a98f 100644 --- a/tests/static-analysis/H.php +++ b/tests/static-analysis/H.php @@ -7,7 +7,7 @@ use loophp\combinator\Combinator\H as Combinator; /** - * @param callable(array): callable(bool): callable(array): string $f + * @param callable(array): (Closure(bool): (Closure(array): (string))) $f * @param array $x * @param bool $y * diff --git a/tests/static-analysis/R.php b/tests/static-analysis/R.php index 1a34fe0..0bf9bfb 100644 --- a/tests/static-analysis/R.php +++ b/tests/static-analysis/R.php @@ -8,7 +8,7 @@ /** * @param bool $x - * @param callable(int): callable(bool): string $f + * @param callable(int): (Closure(bool): (string)) $f * @param int $y * * @return string diff --git a/tests/static-analysis/Y.php b/tests/static-analysis/Y.php index 042ce34..fe90f49 100644 --- a/tests/static-analysis/Y.php +++ b/tests/static-analysis/Y.php @@ -9,8 +9,6 @@ /** * @param callable(callable): Closure $f - * - * @return Closure */ function test(callable $f): Closure { diff --git a/tests/static-analysis/Z.php b/tests/static-analysis/Z.php index d538b82..2a6790a 100644 --- a/tests/static-analysis/Z.php +++ b/tests/static-analysis/Z.php @@ -9,8 +9,6 @@ /** * @param callable(callable): Closure $f - * - * @return Closure */ function test(callable $f): Closure {