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

FixDisabledBugOptionsBuilder::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 7
rs 9.4285
c 1
b 0
f 1
cc 1
eloc 5
nc 1
nop 0
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