Skip to content

Commit 8f6af0a

Browse files
committed
normalized callable to Closure
1 parent 60e7d2a commit 8f6af0a

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

src/Application/PresenterFactory.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,18 @@ class PresenterFactory implements IPresenterFactory
2727
private array $aliases = [];
2828
private array $cache = [];
2929

30-
/** @var callable */
31-
private $factory;
30+
/** @var \Closure(string): IPresenter */
31+
private \Closure $factory;
3232

3333

3434
/**
3535
* @param ?callable(string): IPresenter $factory
3636
*/
3737
public function __construct(?callable $factory = null)
3838
{
39-
$this->factory = $factory ?? fn(string $class): IPresenter => new $class;
39+
$this->factory = $factory
40+
? $factory(...)
41+
: fn(string $class): IPresenter => new $class;
4042
}
4143

4244

src/Application/Responses/CallbackResponse.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717
*/
1818
final class CallbackResponse implements Nette\Application\Response
1919
{
20-
/** @var callable */
21-
private $callback;
20+
/** @var \Closure(Nette\Http\IRequest, Nette\Http\IResponse): void */
21+
private \Closure $callback;
2222

2323

2424
/**
2525
* @param callable(Nette\Http\IRequest, Nette\Http\IResponse): void $callback
2626
*/
2727
public function __construct(callable $callback)
2828
{
29-
$this->callback = $callback;
29+
$this->callback = $callback(...);
3030
}
3131

3232

src/Application/UI/Multiplier.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@
1717
*/
1818
final class Multiplier extends Component
1919
{
20-
/** @var callable */
21-
private $factory;
20+
/** @var \Closure(string, self): Nette\ComponentModel\IComponent */
21+
private \Closure $factory;
2222

2323

24+
/**
25+
* @param callable(string, self): Nette\ComponentModel\IComponent $factory
26+
*/
2427
public function __construct(callable $factory)
2528
{
26-
$this->factory = $factory;
29+
$this->factory = $factory(...);
2730
}
2831

2932

0 commit comments

Comments
 (0)