ENH Fix phpcs violations

This commit is contained in:
Robbie Averill 2019-01-09 20:59:28 +01:00 committed by Guy Sartorelli
parent c5f42d99a3
commit 213f7167a6
No known key found for this signature in database
GPG Key ID: F313E3B9504D496A
8 changed files with 22 additions and 12 deletions

View File

@ -61,7 +61,8 @@ use SilverStripe\View\ViewableData;
* Right now, all subclasses of SS_Report will be shown in the ReportAdmin. In SS3 there is only
* one place where reports can go, so this class is greatly simplifed from its version in SS2.
*
* @method SS_List|DataList sourceRecords($params = [], $sort = null, $limit = null) List of records to show for this report
* @method SS_List|DataList sourceRecords($params = [], $sort = null, $limit = null)
* List of records to show for this report
*/
class Report extends ViewableData
{
@ -158,7 +159,8 @@ class Report extends ViewableData
{
if (!$this->hasMethod('sourceRecords')) {
throw new \RuntimeException(
'Please override sourceQuery()/sourceRecords() and columns() or, if necessary, override getReportField()'
'Please override sourceQuery()/sourceRecords() and columns() or, '
. 'if necessary, override getReportField()'
);
}
@ -353,7 +355,10 @@ class Report extends ViewableData
}
// Add a search button
$formAction = FormAction::create('updatereport', _t('SilverStripe\\Forms\\GridField\\GridField.Filter', 'Filter'));
$formAction = FormAction::create(
'updatereport',
_t('SilverStripe\\Forms\\GridField\\GridField.Filter', 'Filter')
);
$formAction->addExtraClass('btn-primary mb-4');
$fields->push($formAction);

View File

@ -181,13 +181,13 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider
}
//build breadcrumb trail to the current report
$items->push(new ArrayData(array(
$items->push(ArrayData::create([
'Title' => $report->title(),
'Link' => Controller::join_links(
$this->Link(),
'?' . http_build_query(array('q' => $this->request->requestVar('q')))
'?' . http_build_query(['q' => $this->request->requestVar('q')])
)
)));
]));
}
return $items;
@ -236,7 +236,8 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider
);
$gridField = GridField::create('Reports', false, $this->Reports(), $gridFieldConfig);
/** @var GridFieldDataColumns $columns */
$columns = $gridField->getConfig()->getComponentByType('SilverStripe\\Forms\\GridField\\GridFieldDataColumns');
$columns = $gridField->getConfig()
->getComponentByType('SilverStripe\\Forms\\GridField\\GridFieldDataColumns');
$columns->setDisplayFields(array(
'title' => _t('SilverStripe\\Reports\\ReportAdmin.ReportTitle', 'Title'),
));
@ -250,7 +251,9 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider
$actions = new FieldList();
$form = new Form($this, "EditForm", $fields, $actions);
$form->addExtraClass('panel panel--padded panel--scrollable cms-edit-form cms-panel-padded' . $this->BaseCSSClasses());
$form->addExtraClass(
'panel panel--padded panel--scrollable cms-edit-form cms-panel-padded' . $this->BaseCSSClasses()
);
$form->loadDataFrom($this->request->getVars());
$this->extend('updateEditForm', $form);

View File

@ -21,7 +21,7 @@ abstract class ReportWrapper extends Report
public function __construct($baseReport)
{
$this->baseReport = is_string($baseReport) ? new $baseReport : $baseReport;
$this->baseReport = is_string($baseReport) ? new $baseReport() : $baseReport;
$this->dataClass = $this->baseReport->dataClass();
parent::__construct();
}

View File

@ -11,8 +11,8 @@ use SilverStripe\View\ViewableData;
*/
class SideReportView extends ViewableData
{
protected $controller, $report;
protected $controller;
protected $report;
protected $parameters;
public function __construct($controller, $report)

View File

@ -1,4 +1,5 @@
<?php
namespace SilverStripe\Reports\Tests;
use ReflectionClass;

View File

@ -1,4 +1,5 @@
<?php
namespace SilverStripe\Reports\Tests\ReportAdminTest;
use SilverStripe\Dev\TestOnly;

View File

@ -1,4 +1,5 @@
<?php
namespace SilverStripe\Reports\Tests\ReportAdminTest;
use SilverStripe\Control\Controller;

View File

@ -8,7 +8,6 @@ use SilverStripe\Reports\Report;
abstract class FakeTestAbstract extends Report implements TestOnly
{
public function title()
{
return 'Report title Abstract';