Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
CallableResolver
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 resolve
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 creator
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Celemas\Wire;
6
7use Closure;
8use Override;
9use ReflectionFunction;
10
11/** @psalm-api */
12class CallableResolver
13{
14    use ResolvesAbstractFunctions;
15
16    public function __construct(
17        protected readonly CreatorInterface $creator,
18    ) {}
19
20    /** @param callable $callable */
21    public function resolve(
22        array|callable $callable,
23        array $predefinedArgs = [],
24        array $predefinedTypes = [],
25        ?callable $injectCallback = null,
26    ): array {
27        $callable = Closure::fromCallable($callable);
28        $rfn = new ReflectionFunction($callable);
29
30        return $this->resolveArgs($rfn, $predefinedArgs, $predefinedTypes, $injectCallback);
31    }
32
33    #[Override]
34    public function creator(): CreatorInterface
35    {
36        return $this->creator;
37    }
38}

Paths

Below are the source code lines that represent each code path as identified by Xdebug. Please note a path is not necessarily coterminous with a line, a line may contain multiple paths and therefore show up more than once. Please also be aware that some paths may include implicit rather than explicit branches, e.g. an if statement always has an else as part of its logical flow even if you didn't write one.

CallableResolver->__construct
17        protected readonly CreatorInterface $creator,
18    ) {}
CallableResolver->creator
36        return $this->creator;
37    }
CallableResolver->resolve
22        array|callable $callable,
23        array $predefinedArgs = [],
24        array $predefinedTypes = [],
25        ?callable $injectCallback = null,
26    ): array {
27        $callable = Closure::fromCallable($callable);
28        $rfn = new ReflectionFunction($callable);
29
30        return $this->resolveArgs($rfn, $predefinedArgs, $predefinedTypes, $injectCallback);
31    }