From 5cbe29ae682844bd1220d53892e209eb2ff0a5f5 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Wed, 9 Jan 2019 20:59:28 +0100 Subject: [PATCH] Fix phpcs line length violations and multiple properties per line --- src/Report.php | 14 +++++++++++--- src/ReportAdmin.php | 16 +++++++++++----- src/ReportWrapper.php | 2 +- src/SideReportView.php | 4 ++-- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/Report.php b/src/Report.php index dad52df2..53e5b3f0 100644 --- a/src/Report.php +++ b/src/Report.php @@ -59,7 +59,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 { @@ -149,7 +150,11 @@ class Report extends ViewableData if ($this->hasMethod('sourceRecords')) { return $this->sourceRecords($params, null, null)->dataQuery(); } else { - user_error("Please override sourceQuery()/sourceRecords() and columns() or, if necessary, override getReportField()", E_USER_ERROR); + user_error( + "Please override sourceQuery()/sourceRecords() and columns() or, if necessary, " + . "override getReportField()", + E_USER_ERROR + ); } } @@ -313,7 +318,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); diff --git a/src/ReportAdmin.php b/src/ReportAdmin.php index 8173681e..09149537 100644 --- a/src/ReportAdmin.php +++ b/src/ReportAdmin.php @@ -174,10 +174,13 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider if ($this->reportObject) { //build breadcrumb trail to the current report - $items->push(new ArrayData(array( + $items->push(ArrayData::create([ 'Title' => $this->reportObject->title(), - 'Link' => Controller::join_links($this->Link(), '?' . http_build_query(array('q' => $this->request->requestVar('q')))) - ))); + 'Link' => Controller::join_links( + $this->Link(), + '?' . http_build_query(['q' => $this->request->requestVar('q')]) + ) + ])); } return $items; @@ -226,7 +229,8 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider ); $gridField = new GridField('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'), )); @@ -240,7 +244,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); diff --git a/src/ReportWrapper.php b/src/ReportWrapper.php index 7ba44e76..cfcae129 100644 --- a/src/ReportWrapper.php +++ b/src/ReportWrapper.php @@ -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(); } diff --git a/src/SideReportView.php b/src/SideReportView.php index 171ef960..4e15fb55 100644 --- a/src/SideReportView.php +++ b/src/SideReportView.php @@ -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)