diff --git a/code/Report.php b/code/Report.php
index 6120a4c3..45e05c5d 100644
--- a/code/Report.php
+++ b/code/Report.php
@@ -61,7 +61,8 @@
* 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 @@ public function sourceQuery($params)
{
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 @@ public function getCMSFields()
}
// 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/code/ReportAdmin.php b/code/ReportAdmin.php
index 83aa57cb..7d732482 100644
--- a/code/ReportAdmin.php
+++ b/code/ReportAdmin.php
@@ -181,13 +181,13 @@ public function Breadcrumbs($unlinked = false)
}
//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 @@ public function getEditForm($id = null, $fields = null)
);
$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 @@ public function getEditForm($id = null, $fields = null)
$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/code/ReportWrapper.php b/code/ReportWrapper.php
index e6fae9f2..8c0daec6 100644
--- a/code/ReportWrapper.php
+++ b/code/ReportWrapper.php
@@ -2,6 +2,8 @@
namespace SilverStripe\Reports;
+use SilverStripe\Core\Injector\Injector;
+
/**
* SS_ReportWrapper is a base class for creating report wappers.
*
@@ -21,7 +23,7 @@ abstract class ReportWrapper extends Report
public function __construct($baseReport)
{
- $this->baseReport = is_string($baseReport) ? new $baseReport : $baseReport;
+ $this->baseReport = is_string($baseReport) ? Injector::inst()->create($baseReport) : $baseReport;
$this->dataClass = $this->baseReport->dataClass();
parent::__construct();
}
diff --git a/code/SideReportView.php b/code/SideReportView.php
index d80058b9..e7d627b1 100644
--- a/code/SideReportView.php
+++ b/code/SideReportView.php
@@ -11,8 +11,8 @@
*/
class SideReportView extends ViewableData
{
-
- protected $controller, $report;
+ protected $controller;
+ protected $report;
protected $parameters;
public function __construct($controller, $report)
diff --git a/phpcs.xml.dist b/phpcs.xml.dist
index ddad7d2b..44f19d15 100644
--- a/phpcs.xml.dist
+++ b/phpcs.xml.dist
@@ -5,20 +5,9 @@
code
tests
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/tests/ReportAdminTest.php b/tests/ReportAdminTest.php
index f84576b3..dcf7c816 100644
--- a/tests/ReportAdminTest.php
+++ b/tests/ReportAdminTest.php
@@ -1,4 +1,5 @@