GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

FormPrepare   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 25
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 4 1
1
<?php
2
/**
3
 * This view helper makes the view and form available in the renderers
4
 *
5
 * @category  StrokerForm
6
 * @package   StrokerForm\View
7
 * @copyright 2012 Bram Gerritsen
8
 * @version   SVN: $Id$
9
 */
10
11
namespace StrokerForm\View\Helper;
12
13
use StrokerForm\Renderer\RendererInterface;
14
use Zend\Form\FormInterface;
15
use Zend\Form\View\Helper\AbstractHelper;
16
17
class FormPrepare extends AbstractHelper
18
{
19
    /**
20
     * @var RendererInterface
21
     */
22
    private $renderer;
23
24
    /**
25
     * @param RendererInterface $renderer
26
     */
27
    public function __construct(RendererInterface $renderer)
28
    {
29
        $this->renderer = $renderer;
30
    }
31
32
    /**
33
     * @param string                   $formAlias
34
     * @param \Zend\Form\FormInterface $form
35
     * @param array                    $options
36
     */
37
    public function __invoke($formAlias, FormInterface $form = null, array $options = [])
38
    {
39
        $this->renderer->preRenderForm($formAlias, $this->getView(), $form, $options);
0 ignored issues
show
Documentation introduced by
$this->getView() is of type null|object<Zend\View\Renderer\RendererInterface>, but the function expects a object<Zend\View\Renderer\PhpRenderer>.

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
    }
41
}
42