TomSelectSingleField   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 10
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A saveInto() 0 3 1
1
<?php
2
3
namespace LeKoala\FormElements;
4
5
use SilverStripe\Forms\DropdownField;
6
use SilverStripe\ORM\DataObjectInterface;
7
8
/**
9
 * @link https://tom-select.js.org/
10
 */
11
class TomSelectSingleField extends DropdownField implements AjaxPoweredField, LocalizableField, TagsField
12
{
13
    use TomSelect;
0 ignored issues
show
introduced by
The trait LeKoala\FormElements\TomSelect requires some properties which are not provided by LeKoala\FormElements\TomSelectSingleField: $ID, $db
Loading history...
14
15
    /**
16
     * @param DataObject|DataObjectInterface $record The record to save into
0 ignored issues
show
Bug introduced by
The type LeKoala\FormElements\DataObject was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
     */
18
    public function saveInto(DataObjectInterface $record)
19
    {
20
        return parent::saveInto($record);
0 ignored issues
show
Bug introduced by
Are you sure the usage of parent::saveInto($record) targeting SilverStripe\Forms\FormField::saveInto() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
21
    }
22
}
23