Passed
Pull Request — master (#8)
by Robbie
03:25
created

ObjectWithFields   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getCMSFields() 0 7 1
1
<?php
2
3
namespace SilverStripe\VersionedAdmin\Tests\Forms\DataObjectVersionFormFactoryTest;
4
5
use SilverStripe\Dev\TestOnly;
6
use SilverStripe\ORM\DataObject;
7
use SilverStripe\Versioned\Versioned;
8
use SilverStripe\VersionedAdmin\Forms\HistoryViewerField;
9
10
class ObjectWithFields extends DataObject implements TestOnly
11
{
12
    private static $db = [
0 ignored issues
show
introduced by
The private property $db is not used, and could be removed.
Loading history...
13
        'Title' => 'Varchar',
14
        'Age' => 'Int',
15
    ];
16
17
    private static $table_name = 'Test_ObjectWithFields';
0 ignored issues
show
introduced by
The private property $table_name is not used, and could be removed.
Loading history...
18
19
    private static $extensions = [
0 ignored issues
show
introduced by
The private property $extensions is not used, and could be removed.
Loading history...
20
        Versioned::class,
21
    ];
22
23
    public function getCMSFields()
24
    {
25
        $fields = parent::getCMSFields();
26
27
        $fields->addFieldToTab('Root.CustomHistoryTab', HistoryViewerField::create('History'));
0 ignored issues
show
Bug introduced by
'History' of type string is incompatible with the type array expected by parameter $args of SilverStripe\View\ViewableData::create(). ( Ignorable by Annotation )

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

27
        $fields->addFieldToTab('Root.CustomHistoryTab', HistoryViewerField::create(/** @scrutinizer ignore-type */ 'History'));
Loading history...
28
29
        return $fields;
30
    }
31
}
32