Skip to content

Commit

Permalink
Issue #1: Remove PSALM errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Jan 22, 2020
1 parent 49c04b3 commit 1abd2e1
Show file tree
Hide file tree
Showing 24 changed files with 83 additions and 42 deletions.
40 changes: 0 additions & 40 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,44 +12,4 @@
<directory name="vendor" />
</ignoreFiles>
</projectFiles>

<issueHandlers>
<LessSpecificReturnType errorLevel="info" />

<!-- level 3 issues - slightly lazy code writing, but provably low false-negatives -->

<DeprecatedMethod errorLevel="info" />
<DeprecatedProperty errorLevel="info" />
<DeprecatedClass errorLevel="info" />
<DeprecatedConstant errorLevel="info" />
<DeprecatedFunction errorLevel="info" />
<DeprecatedInterface errorLevel="info" />
<DeprecatedTrait errorLevel="info" />

<InternalMethod errorLevel="info" />
<InternalProperty errorLevel="info" />
<InternalClass errorLevel="info" />

<MissingClosureReturnType errorLevel="info" />
<MissingReturnType errorLevel="info" />
<MissingPropertyType errorLevel="info" />
<InvalidDocblock errorLevel="info" />
<MisplacedRequiredParam errorLevel="info" />

<PropertyNotSetInConstructor errorLevel="info" />
<MissingConstructor errorLevel="info" />
<MissingClosureParamType errorLevel="info" />
<MissingParamType errorLevel="info" />

<RedundantCondition errorLevel="info" />

<DocblockTypeContradiction errorLevel="info" />
<RedundantConditionGivenDocblockType errorLevel="info" />

<UnresolvableInclude errorLevel="info" />

<RawObjectIteration errorLevel="info" />

<InvalidStringClass errorLevel="info" />
</issueHandlers>
</psalm>
3 changes: 3 additions & 0 deletions src/Combinator/A.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public function __invoke()
*/
public static function closure(): Closure
{
/**
* @psalm-suppress MissingClosureParamType
*/
return static function (callable $f, $x): Closure {
return Closure::fromCallable([(new self($f, $x)), '__invoke']);
};
Expand Down
3 changes: 3 additions & 0 deletions src/Combinator/B.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ public function __invoke()
*/
public static function closure(): Closure
{
/**
* @psalm-suppress MissingClosureParamType
*/
return static function (callable $f, callable $g, $x): Closure {
return Closure::fromCallable([(new self($f, $g, $x)), '__invoke']);
};
Expand Down
3 changes: 3 additions & 0 deletions src/Combinator/C.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ public function __invoke()
*/
public static function closure(): Closure
{
/**
* @psalm-suppress MissingClosureParamType
*/
return static function (callable $f, $x, $y): Closure {
return Closure::fromCallable([(new self($f, $x, $y)), '__invoke']);
};
Expand Down
3 changes: 3 additions & 0 deletions src/Combinator/D.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ public function __invoke()
*/
public static function closure(): Closure
{
/**
* @psalm-suppress MissingClosureParamType
*/
return static function (callable $f, $x, callable $g, $y): Closure {
return Closure::fromCallable([(new self($f, $x, $g, $y)), '__invoke']);
};
Expand Down
3 changes: 3 additions & 0 deletions src/Combinator/E.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ public function __invoke()
*/
public static function closure(): Closure
{
/**
* @psalm-suppress MissingClosureParamType
*/
return static function (callable $f, $x, callable $g, $y, $z): Closure {
return Closure::fromCallable([(new self($f, $x, $g, $y, $z)), '__invoke']);
};
Expand Down
3 changes: 3 additions & 0 deletions src/Combinator/F.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ public function __invoke()
*/
public static function closure(): Closure
{
/**
* @psalm-suppress MissingClosureParamType
*/
return static function ($x, $y, callable $f): Closure {
return Closure::fromCallable([(new self($x, $y, $f)), '__invoke']);
};
Expand Down
3 changes: 3 additions & 0 deletions src/Combinator/G.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ public function __invoke()
*/
public static function closure(): Closure
{
/**
* @psalm-suppress MissingClosureParamType
*/
return static function (callable $f, callable $g, $x, $y): Closure {
return Closure::fromCallable([(new self($f, $g, $x, $y)), '__invoke']);
};
Expand Down
5 changes: 4 additions & 1 deletion src/Combinator/H.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct(callable $f, $x, $y)
*/
public function __invoke()
{
return ( (($this->f)($this->x)) ($this->y) )($this->x);
return ((($this->f)($this->x))($this->y))($this->x);
}

/**
Expand All @@ -63,6 +63,9 @@ public function __invoke()
*/
public static function closure(): Closure
{
/**
* @psalm-suppress MissingClosureParamType
*/
return static function (callable $f, $x, $y): Closure {
return Closure::fromCallable([(new self($f, $x, $y)), '__invoke']);
};
Expand Down
3 changes: 3 additions & 0 deletions src/Combinator/I.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public function __invoke()
*/
public static function closure(): Closure
{
/**
* @psalm-suppress MissingClosureParamType
*/
return static function ($x): Closure {
return Closure::fromCallable([(new self($x)), '__invoke']);
};
Expand Down
3 changes: 3 additions & 0 deletions src/Combinator/J.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ public function __invoke()
*/
public static function closure(): Closure
{
/**
* @psalm-suppress MissingClosureParamType
*/
return static function (callable $f, $x, $y, $z): Closure {
return Closure::fromCallable([(new self($f, $x, $y, $z)), '__invoke']);
};
Expand Down
3 changes: 3 additions & 0 deletions src/Combinator/K.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public function __invoke()
*/
public static function closure(): Closure
{
/**
* @psalm-suppress MissingClosureParamType
*/
return static function ($x, $y): Closure {
return Closure::fromCallable([(new self($x, $y)), '__invoke']);
};
Expand Down
3 changes: 3 additions & 0 deletions src/Combinator/L.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public function __invoke()
*/
public static function closure(): Closure
{
/**
* @psalm-suppress MissingClosureParamType
*/
return static function (callable $f, callable $g): Closure {
return Closure::fromCallable([(new self($f, $g)), '__invoke']);
};
Expand Down
3 changes: 3 additions & 0 deletions src/Combinator/M.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public function __invoke()
*/
public static function closure(): Closure
{
/**
* @psalm-suppress MissingClosureParamType
*/
return static function (callable $f): Closure {
return Closure::fromCallable([(new self($f)), '__invoke']);
};
Expand Down
3 changes: 3 additions & 0 deletions src/Combinator/O.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public function __invoke()
*/
public static function closure(): Closure
{
/**
* @psalm-suppress MissingClosureParamType
*/
return static function (callable $f, callable $g): Closure {
return Closure::fromCallable([(new self($f, $g)), '__invoke']);
};
Expand Down
3 changes: 3 additions & 0 deletions src/Combinator/Psi.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ public function __invoke()
*/
public static function closure(): Closure
{
/**
* @psalm-suppress MissingClosureParamType
*/
return static function (callable $f, callable $g, $x, $y): Closure {
return Closure::fromCallable([(new self($f, $g, $x, $y)), '__invoke']);
};
Expand Down
3 changes: 3 additions & 0 deletions src/Combinator/Q.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ public function __invoke()
*/
public static function closure(): Closure
{
/**
* @psalm-suppress MissingClosureParamType
*/
return static function (callable $f, callable $g, $x): Closure {
return Closure::fromCallable([(new self($f, $g, $x)), '__invoke']);
};
Expand Down
3 changes: 3 additions & 0 deletions src/Combinator/R.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ public function __invoke()
*/
public static function closure(): Closure
{
/**
* @psalm-suppress MissingClosureParamType
*/
return static function ($x, callable $f, $y): Closure {
return Closure::fromCallable([(new self($x, $f, $y)), '__invoke']);
};
Expand Down
3 changes: 3 additions & 0 deletions src/Combinator/S.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ public function __invoke()
*/
public static function closure(): Closure
{
/**
* @psalm-suppress MissingClosureParamType
*/
return static function (callable $f, callable $g, $x): Closure {
return Closure::fromCallable([(new self($f, $g, $x)), '__invoke']);
};
Expand Down
3 changes: 3 additions & 0 deletions src/Combinator/T.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public function __invoke()
*/
public static function closure(): Closure
{
/**
* @psalm-suppress MissingClosureParamType
*/
return static function ($x, callable $f): Closure {
return Closure::fromCallable([(new self($x, $f)), '__invoke']);
};
Expand Down
3 changes: 3 additions & 0 deletions src/Combinator/U.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public function __invoke()
*/
public static function closure(): Closure
{
/**
* @psalm-suppress MissingClosureParamType
*/
return static function (callable $f, callable $g): Closure {
return Closure::fromCallable([(new self($f, $g)), '__invoke']);
};
Expand Down
3 changes: 3 additions & 0 deletions src/Combinator/V.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ public function __invoke()
*/
public static function closure(): Closure
{
/**
* @psalm-suppress MissingClosureParamType
*/
return static function ($x, $y, callable $f): Closure {
return Closure::fromCallable([(new self($x, $y, $f)), '__invoke']);
};
Expand Down
3 changes: 3 additions & 0 deletions src/Combinator/W.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public function __invoke()
*/
public static function closure(): Closure
{
/**
* @psalm-suppress MissingClosureParamType
*/
return static function (callable $f, $x): Closure {
return Closure::fromCallable([(new self($f, $x)), '__invoke']);
};
Expand Down
17 changes: 16 additions & 1 deletion src/Combinator/Y.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,20 @@ public function __invoke()
{
$callable = $this->f;

$f = static function (callable $f) use ($callable): Closure {
/**
* @psalm-suppress MissingClosureReturnType
*
* @param callable $f
*
* @return mixed
*/
$f = static function (callable $f) use ($callable) {
return $callable(
/**
* @psalm-suppress MissingClosureParamType
*
* @param array $arguments
*/
static function (...$arguments) use ($f) {
return $f($f)(...$arguments);
}
Expand All @@ -56,6 +68,9 @@ static function (...$arguments) use ($f) {
*/
public static function closure(): Closure
{
/**
* @psalm-suppress MissingClosureParamType
*/
return static function (callable $f): callable {
return Closure::fromCallable([(new self($f)), '__invoke']);
};
Expand Down

0 comments on commit 1abd2e1

Please sign in to comment.