Completed
Push — SF4 ( d6b20c...62ceda )
by Laurent
01:59
created

SupplierController::removeSupplierEntity()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/*
4
 * To change this license header, choose License Headers in Project Properties.
5
 * To change this template file, choose Tools | Templates
6
 * and open the template in the editor.
7
 */
8
9
namespace App\Controller;
10
11
use App\Entity\Settings\Supplier;
12
13
/**
14
 * Description of SupplierController
15
 *
16
 * @author dev-int
17
 */
18
class SupplierController
19
{
20
    /**
21
     * Allows applications to modify the entity associated with the item being
22
     * deleted before removing it.
23
     *
24
     * @param Article $supplier
25
     */
26
    protected function removeSupplierEntity(Supplier $supplier)
27
    {
28
        $supplier->setActive(0);
0 ignored issues
show
Documentation introduced by
0 is of type integer, but the function expects a boolean.

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...
29
        $this->em->persist($supplier);
1 ignored issue
show
Bug introduced by
The property em does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
30
        $this->em->flush();
31
    }
32
}
33