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 * 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. * 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 class Report extends ViewableData
{ {
@ -158,7 +159,8 @@ class Report extends ViewableData
{ {
if (!$this->hasMethod('sourceRecords')) { if (!$this->hasMethod('sourceRecords')) {
throw new \RuntimeException( 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 // 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'); $formAction->addExtraClass('btn-primary mb-4');
$fields->push($formAction); $fields->push($formAction);

View File

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

View File

@ -21,7 +21,7 @@ abstract class ReportWrapper extends Report
public function __construct($baseReport) 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(); $this->dataClass = $this->baseReport->dataClass();
parent::__construct(); parent::__construct();
} }

View File

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

View File

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

View File

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

View File

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

View File

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