From 4e5630128d626ef3d96c7a80e343fc165eb6a8cf Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 20 Oct 2021 08:40:27 +0200 Subject: [PATCH] Reorder PHPDoc properties. --- src/Identity.php | 57 ++++++------------- .../Identity/IdentityApplicative.php | 34 +++++------ src/Instances/Identity/IdentityApply.php | 24 ++++---- src/Instances/Identity/IdentityFoldable.php | 6 +- src/Instances/Identity/IdentityFunctor.php | 14 ++--- src/Instances/Identity/IdentityMonad.php | 44 ++++++-------- .../Identity/IdentityTraversable.php | 24 +++----- 7 files changed, 76 insertions(+), 127 deletions(-) diff --git a/src/Identity.php b/src/Identity.php index 42b32e3..54454b5 100644 --- a/src/Identity.php +++ b/src/Identity.php @@ -23,12 +23,12 @@ use Marcosh\LamPHPda\Typeclass\Traversable; /** - * @psalm-immutable - * * @template A * * @implements DefaultMonad * @implements DefaultTraversable + * + * @psalm-immutable */ final class Identity implements DefaultMonad, DefaultTraversable { @@ -46,13 +46,11 @@ private function __construct($value) } /** - * @psalm-pure - * * @template B - * * @param B $value - * * @return Identity + * + * @psalm-pure */ public static function wrap($value): Identity { @@ -60,13 +58,11 @@ public static function wrap($value): Identity } /** - * @psalm-pure - * * @template B - * * @param HK1 $b - * * @return Identity + * + * @psalm-pure */ public static function fromBrand(HK1 $b): Identity { @@ -84,21 +80,19 @@ public function unwrap() /** * @template B - * * @param Functor $functor * @param callable(A): B $f - * * @return Identity + * + * @psalm-suppress ArgumentTypeCoercion */ public function imap(Functor $functor, callable $f): Identity { - /** @psalm-suppress ArgumentTypeCoercion */ return self::fromBrand($functor->map($f, $this)); } /** * @template B - * * @param callable(A): B $f * @return Identity * @@ -111,21 +105,19 @@ public function map(callable $f): Identity /** * @template B - * * @param Apply $apply * @param HK1 $f - * * @return Identity + * + * @psalm-suppress ArgumentTypeCoercion */ public function iapply(Apply $apply, HK1 $f): Identity { - /** @psalm-suppress ArgumentTypeCoercion */ return self::fromBrand($apply->apply($f, $this)); } /** * @template B - * * @param HK1 $f * @return Identity * @@ -138,10 +130,8 @@ public function apply(HK1 $f): Identity /** * @template B - * * @param Applicative $applicative * @param B $a - * * @return Identity */ public static function ipure(Applicative $applicative, $a): Identity @@ -151,9 +141,7 @@ public static function ipure(Applicative $applicative, $a): Identity /** * @template B - * * @param B $a - * * @return Identity * * @psalm-suppress LessSpecificImplementedReturnType @@ -165,23 +153,20 @@ public static function pure($a): Identity /** * @template B - * * @param Monad $monad * @param callable(A): HK1 $f - * * @return Identity + * + * @psalm-suppress ArgumentTypeCoercion */ public function ibind(Monad $monad, callable $f): Identity { - /** @psalm-suppress ArgumentTypeCoercion */ return self::fromBrand($monad->bind($this, $f)); } /** * @template B - * * @param callable(A): HK1 $f - * * @return Identity * * @psalm-suppress LessSpecificImplementedReturnType @@ -193,25 +178,22 @@ public function bind(callable $f): Identity /** * @template B - * * @param Foldable $foldable * @param callable(A, B): B $f * @param B $b - * * @return B + * + * @psalm-suppress ArgumentTypeCoercion */ public function ifoldr(Foldable $foldable, callable $f, $b) { - /** @psalm-suppress ArgumentTypeCoercion */ return $foldable->foldr($f, $b, $this); } /** * @template B - * * @param callable(A, B): B $f * @param B $b - * * @return B */ public function foldr(callable $f, $b) @@ -222,29 +204,24 @@ public function foldr(callable $f, $b) /** * @template F of Brand * @template B - * * @param Traversable $traversable * @param Applicative $applicative * @param callable(A): HK1 $f - * * @return HK1> + * + * @psalm-suppress InvalidArgument + * @psalm-suppress ArgumentTypeCoercion */ public function itraverse(Traversable $traversable, Applicative $applicative, callable $f): HK1 { - /** - * @psalm-suppress InvalidArgument - * @psalm-suppress ArgumentTypeCoercion - */ return $applicative->map([Identity::class, 'fromBrand'], $traversable->traverse($applicative, $f, $this)); } /** * @template F of Brand * @template B - * * @param Applicative $applicative * @param callable(A): HK1 $f - * * @return HK1> * * @psalm-suppress LessSpecificImplementedReturnType diff --git a/src/Instances/Identity/IdentityApplicative.php b/src/Instances/Identity/IdentityApplicative.php index aa328cf..a75995d 100644 --- a/src/Instances/Identity/IdentityApplicative.php +++ b/src/Instances/Identity/IdentityApplicative.php @@ -10,24 +10,22 @@ use Marcosh\LamPHPda\Typeclass\Applicative; /** - * @psalm-immutable - * * @implements Applicative + * + * @psalm-immutable */ final class IdentityApplicative implements Applicative { /** - * @psalm-suppress LessSpecificImplementedReturnType - * - * @psalm-pure - * * @template A * @template B - * * @param callable(A): B $f * @param HK1 $a - * * @return Identity + * + * @psalm-pure + * + * @psalm-suppress LessSpecificImplementedReturnType */ public function map(callable $f, $a): Identity { @@ -35,17 +33,15 @@ public function map(callable $f, $a): Identity } /** - * @psalm-suppress LessSpecificImplementedReturnType - * - * @psalm-pure - * * @template A * @template B - * * @param HK1 $f * @param HK1 $a - * * @return Identity + * + * @psalm-pure + * + * @psalm-suppress LessSpecificImplementedReturnType */ public function apply(HK1 $f, HK1 $a): Identity { @@ -53,15 +49,13 @@ public function apply(HK1 $f, HK1 $a): Identity } /** - * @psalm-suppress LessSpecificImplementedReturnType - * - * @psalm-pure - * * @template A - * * @param A $a - * * @return Identity + * + * @psalm-pure + * + * @psalm-suppress LessSpecificImplementedReturnType */ public function pure($a): Identity { diff --git a/src/Instances/Identity/IdentityApply.php b/src/Instances/Identity/IdentityApply.php index 8223999..5924ebe 100644 --- a/src/Instances/Identity/IdentityApply.php +++ b/src/Instances/Identity/IdentityApply.php @@ -10,24 +10,22 @@ use Marcosh\LamPHPda\Typeclass\Apply; /** - * @psalm-immutable - * * @implements Apply + * + * @psalm-immutable */ final class IdentityApply implements Apply { /** - * @psalm-suppress LessSpecificImplementedReturnType - * - * @psalm-pure - * * @template A * @template B - * * @param callable(A): B $f * @param HK1 $a - * * @return Identity + * + * @psalm-pure + * + * @psalm-suppress LessSpecificImplementedReturnType */ public function map(callable $f, $a): Identity { @@ -35,17 +33,15 @@ public function map(callable $f, $a): Identity } /** - * @psalm-suppress LessSpecificImplementedReturnType - * - * @psalm-pure - * * @template A * @template B - * * @param HK1 $f * @param HK1 $a - * * @return Identity + * + * @psalm-pure + * + * @psalm-suppress LessSpecificImplementedReturnType */ public function apply(HK1 $f, HK1 $a): Identity { diff --git a/src/Instances/Identity/IdentityFoldable.php b/src/Instances/Identity/IdentityFoldable.php index 2892f6d..3404cbf 100644 --- a/src/Instances/Identity/IdentityFoldable.php +++ b/src/Instances/Identity/IdentityFoldable.php @@ -10,20 +10,18 @@ use Marcosh\LamPHPda\Typeclass\Foldable; /** - * @psalm-immutable - * * @implements Foldable + * + * @psalm-immutable */ final class IdentityFoldable implements Foldable { /** * @template A * @template B - * * @param callable(A, B): B $f * @param B $b * @param HK1 $a - * * @return B */ public function foldr(callable $f, $b, HK1 $a) diff --git a/src/Instances/Identity/IdentityFunctor.php b/src/Instances/Identity/IdentityFunctor.php index 5ba762f..8c6c6a3 100644 --- a/src/Instances/Identity/IdentityFunctor.php +++ b/src/Instances/Identity/IdentityFunctor.php @@ -10,24 +10,22 @@ use Marcosh\LamPHPda\Typeclass\Functor; /** - * @psalm-immutable - * * @implements Functor + * + * @psalm-immutable */ final class IdentityFunctor implements Functor { /** - * @psalm-suppress LessSpecificImplementedReturnType - * - * @psalm-pure - * * @template A * @template B - * * @param callable(A): B $f * @param HK1 $a - * * @return Identity + * + * @psalm-pure + * + * @psalm-suppress LessSpecificImplementedReturnType */ public function map(callable $f, $a): Identity { diff --git a/src/Instances/Identity/IdentityMonad.php b/src/Instances/Identity/IdentityMonad.php index 4719cd6..5693f76 100644 --- a/src/Instances/Identity/IdentityMonad.php +++ b/src/Instances/Identity/IdentityMonad.php @@ -10,24 +10,22 @@ use Marcosh\LamPHPda\Typeclass\Monad; /** - * @psalm-immutable - * * @implements Monad + * + * @psalm-immutable */ final class IdentityMonad implements Monad { /** - * @psalm-suppress LessSpecificImplementedReturnType - * - * @psalm-pure - * * @template A * @template B - * * @param callable(A): B $f * @param HK1 $a - * * @return Identity + * + * @psalm-pure + * + * @psalm-suppress LessSpecificImplementedReturnType */ public function map(callable $f, $a): Identity { @@ -35,17 +33,15 @@ public function map(callable $f, $a): Identity } /** - * @psalm-suppress LessSpecificImplementedReturnType - * - * @psalm-pure - * * @template A * @template B - * * @param HK1 $f * @param HK1 $a - * * @return Identity + * + * @psalm-pure + * + * @psalm-suppress LessSpecificImplementedReturnType */ public function apply(HK1 $f, HK1 $a): Identity { @@ -53,15 +49,13 @@ public function apply(HK1 $f, HK1 $a): Identity } /** - * @psalm-suppress LessSpecificImplementedReturnType - * - * @psalm-pure - * * @template A - * * @param A $a - * * @return Identity + * + * @psalm-pure + * + * @psalm-suppress LessSpecificImplementedReturnType */ public function pure($a): Identity { @@ -69,17 +63,15 @@ public function pure($a): Identity } /** - * @psalm-suppress LessSpecificImplementedReturnType - * - * @psalm-pure - * * @template A * @template B - * * @param HK1 $a * @param callable(A): HK1 $f - * * @return Identity + * + * @psalm-pure + * + * @psalm-suppress LessSpecificImplementedReturnType */ public function bind(HK1 $a, callable $f): Identity { diff --git a/src/Instances/Identity/IdentityTraversable.php b/src/Instances/Identity/IdentityTraversable.php index 665fa9c..d2a86ff 100644 --- a/src/Instances/Identity/IdentityTraversable.php +++ b/src/Instances/Identity/IdentityTraversable.php @@ -12,24 +12,22 @@ use Marcosh\LamPHPda\Typeclass\Traversable; /** - * @psalm-immutable - * * @implements Traversable + * + * @psalm-immutable */ final class IdentityTraversable implements Traversable { /** - * @psalm-pure - * - * @psalm-suppress LessSpecificImplementedReturnType - * * @template A * @template B - * * @param callable(A): B $f * @param HK1 $a - * * @return Identity + * + * @psalm-pure + * + * @psalm-suppress LessSpecificImplementedReturnType */ public function map(callable $f, $a): Identity { @@ -39,11 +37,9 @@ public function map(callable $f, $a): Identity /** * @template A * @template B - * * @param callable(A, B): B $f * @param B $b * @param HK1 $a - * * @return B */ public function foldr(callable $f, $b, HK1 $a) @@ -52,18 +48,16 @@ public function foldr(callable $f, $b, HK1 $a) } /** - * @psalm-suppress ImplementedReturnTypeMismatch - * @psalm-suppress LessSpecificImplementedReturnType - * * @template F of Brand * @template A * @template B - * * @param Applicative $applicative * @param callable(A): HK1 $f * @param HK1 $a - * * @return HK1> + * + * @psalm-suppress ImplementedReturnTypeMismatch + * @psalm-suppress LessSpecificImplementedReturnType */ public function traverse(Applicative $applicative, callable $f, HK1 $a): HK1 {