Completed
Push — master ( c833c1...b511be )
by Song
03:16
created

HandleCascadeFields::callWithDependency()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Encore\Admin\Form\Concerns;
4
5
use Encore\Admin\Form\Field;
6
7
trait HandleCascadeFields
8
{
9
    /**
10
     * @var array
11
     */
12
    protected $dependency;
13
14
    /**
15
     * @return array
16
     */
17
    public function getDependency()
18
    {
19
        return $this->dependency;
20
    }
21
22
    /**
23
     * @param array $dependency
24
     * @param \Closure $closure
25
     */
26
    public function callWithDependency(array $dependency, \Closure $closure)
27
    {
28
        $this->dependency = $dependency;
29
30
        call_user_func($closure, $this);
31
32
        $this->dependency = null;
0 ignored issues
show
Documentation Bug introduced by
It seems like null of type null is incompatible with the declared type array of property $dependency.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
33
    }
34
}
35