diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 0000000..4b9d758 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,12 @@ +parameters: + ignoreErrors: + - + message: "#^Parameter \\#1 \\$ of callable callable\\(TResult, TValue\\)\\: TResult expects TResult, TResult\\|null given\\.$#" + count: 1 + path: src/iterable-functions.php + + - + message: "#^Function BenTools\\\\IterableFunctions\\\\iterable_reduce\\(\\) should return TResult but returns TResult\\|null\\.$#" + count: 1 + path: src/iterable-functions.php + diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 7e29c96..aee4ee1 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -10,3 +10,6 @@ parameters: - '~Method BenTools\\IterableFunctions\\IterableObject::map\(\) should return BenTools\\IterableFunctions\\IterableObject but returns BenTools\\IterableFunctions\\IterableObject~' - '~Function BenTools\\IterableFunctions\\iterable_map\(\) should return iterable but returns array\|BenTools\\IterableFunctions\\IterableObject~' + +includes: + - phpstan-baseline.neon diff --git a/src/iterable-functions.php b/src/iterable-functions.php index f7f379c..2fa067b 100644 --- a/src/iterable-functions.php +++ b/src/iterable-functions.php @@ -95,10 +95,10 @@ function iterable_filter(iterable $iterable, ?callable $filter = null): iterable * Reduces an iterable. * * @param iterable $iterable - * @param callable(TResult|null, TValue):TResult $reduce - * @param TResult|null $initial + * @param TResult $initial + * @param callable(TResult, TValue):TResult $reduce * - * @return TResult|null + * @return TResult * * @template TValue * @template TResult