Issues (368)

Admin/Form/Fields/Concerns/HasSelectOptions.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Arbory\Base\Admin\Form\Fields\Concerns;
4
5
use Illuminate\Support\Collection;
6
7
/**
8
 * Class HasSelectOptions.
9
 */
10
trait HasSelectOptions
11
{
12
    /**
13
     * @var Collection
14
     */
15
    protected $options;
16
17
    /**
18
     * @param  Collection|array  $options
19
     * @return $this
20
     */
21
    public function options($options)
22
    {
23
        if (is_array($options)) {
24
            $options = new Collection($options);
0 ignored issues
show
$options of type array is incompatible with the type Illuminate\Contracts\Support\Arrayable expected by parameter $items of Illuminate\Support\Collection::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

24
            $options = new Collection(/** @scrutinizer ignore-type */ $options);
Loading history...
25
        }
26
27
        $this->options = $options;
28
29
        return $this;
30
    }
31
32
    /**
33
     * @return Collection
34
     */
35
    public function getOptions(): Collection
36
    {
37
        return $this->options;
38
    }
39
}
40