Completed
Push — master ( 8b9114...86ab3d )
by Alex
07:01 queued 04:44
created

src/TwigFormatter.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
declare(strict_types = 1);
3
4
namespace AlexMasterov\EquipTwig;
5
6
use Equip\Formatter\HtmlFormatter;
7
use Twig_Environment;
8
9
final class TwigFormatter extends HtmlFormatter
10
{
11
    /**
12
     * @var Twig_Environment
13
     */
14
    private $environment;
15
16
    /**
17
     * @var string
18
     */
19
    private $template;
20
21
    public function __construct(Twig_Environment $environment)
22
    {
23 3
        $this->environment = $environment;
24
    }
25 3
26 3
    public function withTemplate(string $template): self
27
    {
28
        $copy = clone $this;
29
        $copy->template = $template;
30
31
        return $copy;
32
    }
33
34
    /**
35 1
     * @inheritDoc
36
     */
37 1
    public function format(string $content): string
38 1
    {
39
        return $this->environment->render($this->template, $content);
0 ignored issues
show
$content is of type string, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
40 1
    }
41
}
42