Passed
Push — master ( f8cd9d...3b3625 )
by Mike
06:56
created

TwigService   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 15
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 0 3 1
1
<?php
2
3
4
namespace Xervice\Twig\Business\Kernel;
5
6
7
use Xervice\Core\Locator\AbstractWithLocator;
8
use Xervice\Kernel\Business\Service\ClearServiceInterface;
9
10
/**
11
 * @method \Xervice\Twig\TwigFacade getFacade()
12
 */
13
class TwigService extends AbstractWithLocator implements ClearServiceInterface
14
{
15
    /**
16
     * @param string $template
17
     * @param array $params
18
     *
19
     * @return string
20
     * @throws \Core\Locator\Dynamic\ServiceNotParseable
21
     * @throws \Twig_Error_Loader
22
     * @throws \Twig_Error_Runtime
23
     * @throws \Twig_Error_Syntax
24
     */
25
    public function render(string $template, array $params = []): string
26
    {
27
        $this->getFacade()->render($template, $params);
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return string. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
28
    }
29
}