Skip to content

Commit

Permalink
increase the PHPStan level #6
Browse files Browse the repository at this point in the history
  • Loading branch information
devmoath committed Dec 17, 2021
1 parent 7b3c37a commit cad88cf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
level: 1
level: 8

paths:
- src
Expand Down
14 changes: 14 additions & 0 deletions src/helpers.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<?php

if (! function_exists('tap')) {
/**
* @param mixed $value
* @param callable $callback
* @return mixed
*/
function tap(mixed $value, callable $callback): mixed
{
$callback($value);
Expand All @@ -10,6 +15,10 @@ function tap(mixed $value, callable $callback): mixed
}

if (! function_exists('array_wrap')) {
/**
* @param mixed $value
* @return array<int, mixed>
*/
function array_wrap(mixed $value): array
{
if (is_null($value)) {
Expand All @@ -21,6 +30,11 @@ function array_wrap(mixed $value): array
}

if (! function_exists('value')) {
/**
* @param mixed $value
* @param mixed ...$args
* @return mixed
*/
function value(mixed $value, mixed ...$args): mixed
{
return $value instanceof Closure ? $value(...$args) : $value;
Expand Down

0 comments on commit cad88cf

Please sign in to comment.