Skip to content

Commit a6c7292

Browse files
committed
Make fp4php/functional as peer dependency
1 parent 6ebaabe commit a6c7292

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ Helpers for plugin authoring and static testing tool.
44

55
### Installation
66

7+
Package `fp4php/functional` must be installed manually.
8+
79
```shell
8-
$ composer require --dev fp4php/psalm-toolkit
10+
$ composer require --dev fp4php/functional fp4php/psalm-toolkit
911
$ vendor/bin/psalm-plugin enable fp4php/psalm-toolkit
1012
```
1113

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
},
2222
"require": {
2323
"php": "^8.0",
24-
"vimeo/psalm": "^4.13",
25-
"fp4php/functional": "^4.16"
24+
"vimeo/psalm": "^4.13"
25+
},
26+
"require-dev": {
27+
"fp4php/functional": "^4.18"
2628
}
2729
}

src/Toolkit/Args.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,19 @@ public function getCallArgs(MethodReturnTypeProviderEvent | FunctionReturnTypePr
4949
$from instanceof FunctionReturnTypeProviderEvent => $from->getStatementsSource(),
5050
};
5151

52-
return ArrayList::collect($from->getCallArgs())->everyMap(
53-
fn($arg) => Option::do(fn() => new CallArg(
54-
node: $arg,
55-
location: new CodeLocation($source, $arg),
56-
type: yield $this->getArgType($from, $arg),
57-
))
58-
);
52+
return Option::do(function() use ($from, $source) {
53+
$args = [];
54+
55+
foreach ($from->getCallArgs() as $arg) {
56+
$args[] = new CallArg(
57+
node: $arg,
58+
location: new CodeLocation($source, $arg),
59+
type: yield $this->getArgType($from, $arg),
60+
);
61+
}
62+
63+
return ArrayList::collect($args);
64+
});
5965
}
6066

6167
/**

0 commit comments

Comments
 (0)