Completed
Branch master (5acf81)
by Steevan
04:21
created

FixDisabledBugOptionsBuilder   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
1
<?php
2
3
namespace steevanb\SymfonyFormOptionsBuilder\OptionsBuilder;
4
5
/**
6
 * Use it to fix disabled configuration bug :
7
 * If all your fields are disabled, your browser doesn't send anything
8
 * In this case, Symfony understand that you want to delete element, instead of do not modify it.
9
 * You have to call form_widget(form.foo) in your template to write this input in HTML
10
 */
11
class FixDisabledBugOptionsBuilder extends HiddenOptionsBuilder
12
{
13
    public function __construct()
14
    {
15
        $this
16
            ->setMapped(false)
17
            ->setLabel(false)
0 ignored issues
show
Documentation introduced by
false is of type boolean, but the function expects a 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...
18
            ->setTranslationDomain(false);
0 ignored issues
show
Documentation introduced by
false is of type boolean, but the function expects a 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...
19
    }
20
}
21