File   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 23
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 0 12 2
1
<?php
2
3
/**
4
 * This file is part of slick/form package
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Slick\Form\Renderer;
11
12
/**
13
 * File renderer
14
 *
15
 * @package Slick\Form\Renderer
16
 * @author  Filipe Silva <[email protected]>
17
 */
18
class File extends Input implements RendererInterface
19
{
20
21
    /**
22
     * Render the HTML element in the provided context
23
     *
24
     * @param array $context
25
     *
26
     * @return string The HTML string output
27
     */
28 2
    public function render($context = [])
29
    {
30 2
        $element = clone $this->element;
31
32 2
        $value = $this->element->getAttribute('value', false);
0 ignored issues
show
Documentation introduced by
false is of type boolean, but the function expects a null|string.

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...
33 2
        if ($value !== false) {
34 2
            $this->element->getAttributes()->remove('value');
35 2
        }
36 2
        $html = parent::render($context);
37 2
        $this->element = $element;
38 2
        return $html;
39
    }
40
}