| Conditions | 6 | 
| Paths | 5 | 
| Total Lines | 38 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 9 | public function display($titles = [])  | 
            ||
| 10 |     { | 
            ||
| 11 |         if (empty($this->value)) { | 
            ||
| 12 | return '';  | 
            ||
| 13 | }  | 
            ||
| 14 | |||
| 15 |         if (empty($titles)) { | 
            ||
| 16 | $titles = array_keys($this->value[0]);  | 
            ||
| 17 | }  | 
            ||
| 18 | |||
| 19 |         if (Arr::isAssoc($titles)) { | 
            ||
| 20 | $columns = array_keys($titles);  | 
            ||
| 21 |         } else { | 
            ||
| 22 | $titles = array_combine($titles, $titles);  | 
            ||
| 23 | $columns = $titles;  | 
            ||
| 24 | }  | 
            ||
| 25 | |||
| 26 |         $data = array_map(function ($item) use ($columns) { | 
            ||
| 27 | $sorted = [];  | 
            ||
| 28 | |||
| 29 | $arr = array_only($item, $columns);  | 
            ||
| 30 | |||
| 31 |             foreach ($columns as $column) { | 
            ||
| 32 |                 if (array_key_exists($column, $arr)) { | 
            ||
| 33 | $sorted[$column] = $arr[$column];  | 
            ||
| 34 | }  | 
            ||
| 35 | }  | 
            ||
| 36 | |||
| 37 | return $sorted;  | 
            ||
| 38 | }, $this->value);  | 
            ||
| 39 | |||
| 40 | $variables = [  | 
            ||
| 41 | 'titles' => $titles,  | 
            ||
| 42 | 'data' => $data,  | 
            ||
| 43 | ];  | 
            ||
| 44 | |||
| 45 |         return view('admin::grid.displayer.table', $variables)->render(); | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 46 | }  | 
            ||
| 47 | }  | 
            ||
| 48 | 
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: