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

TwigService::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
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
}