From 24db0da047081af098e6e6e556577b29ba789fc1 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Fri, 26 Jan 2018 13:40:06 +1300 Subject: [PATCH] Fix PSR-2 rule violations and incorrect docblock return type --- src/GridFieldConfigurablePaginator.php | 15 +++++++++------ src/GridFieldOrderableRows.php | 8 ++++---- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/GridFieldConfigurablePaginator.php b/src/GridFieldConfigurablePaginator.php index f3af8d5..3655ae9 100644 --- a/src/GridFieldConfigurablePaginator.php +++ b/src/GridFieldConfigurablePaginator.php @@ -5,8 +5,8 @@ namespace Symbiote\GridFieldExtensions; use Exception; use SilverStripe\Core\Config\Configurable; use SilverStripe\Forms\GridField\GridField; -use SilverStripe\Forms\GridField\GridFieldPaginator; use SilverStripe\Forms\GridField\GridField_FormAction; +use SilverStripe\Forms\GridField\GridFieldPaginator; use SilverStripe\Forms\GridField\GridState_Data; use SilverStripe\ORM\ArrayList; use SilverStripe\ORM\Limitable; @@ -269,7 +269,7 @@ class GridFieldConfigurablePaginator extends GridFieldPaginator * {@inheritDoc} * * @param GridField $gridField - * @return ArrayList|null + * @return ArrayData|null */ public function getTemplateParameters(GridField $gridField) { @@ -281,7 +281,7 @@ class GridFieldConfigurablePaginator extends GridFieldPaginator // Figure out which page and record range we're on if (!$arguments['total-rows']) { - return; + return null; } // Define a list of the FormActions that should be generated for pager controls (see getPagerActions()) @@ -289,13 +289,15 @@ class GridFieldConfigurablePaginator extends GridFieldPaginator 'first' => array( 'title' => 'First', 'args' => array('first-shown' => 1), - 'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-double-left ss-gridfield-firstpage', + 'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-double-left ' + . 'ss-gridfield-firstpage', 'disable-previous' => ($this->getCurrentPage() == 1) ), 'prev' => array( 'title' => 'Previous', 'args' => array('first-shown' => $arguments['first-shown'] - $this->getItemsPerPage()), - 'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-left ss-gridfield-previouspage', + 'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-left ' + . 'ss-gridfield-previouspage', 'disable-previous' => ($this->getCurrentPage() == 1) ), 'next' => array( @@ -307,7 +309,8 @@ class GridFieldConfigurablePaginator extends GridFieldPaginator 'last' => array( 'title' => 'Last', 'args' => array('first-shown' => ($this->getTotalPages() - 1) * $this->getItemsPerPage() + 1), - 'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-double-right ss-gridfield-lastpage', + 'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-double-right ' + . 'ss-gridfield-lastpage', 'disable-next' => ($this->getCurrentPage() == $arguments['total-pages']) ), 'pagesize' => array( diff --git a/src/GridFieldOrderableRows.php b/src/GridFieldOrderableRows.php index 91cb6d3..8e52a33 100755 --- a/src/GridFieldOrderableRows.php +++ b/src/GridFieldOrderableRows.php @@ -11,17 +11,17 @@ use SilverStripe\Forms\GridField\GridField_DataManipulator; use SilverStripe\Forms\GridField\GridField_HTMLProvider; use SilverStripe\Forms\GridField\GridField_SaveHandler; use SilverStripe\Forms\GridField\GridField_URLHandler; +use SilverStripe\Forms\GridField\GridFieldPaginator; use SilverStripe\Forms\HiddenField; use SilverStripe\ORM\ArrayList; -use SilverStripe\ORM\DataObject; -use SilverStripe\ORM\DB; use SilverStripe\ORM\DataList; +use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObjectInterface; +use SilverStripe\ORM\DB; use SilverStripe\ORM\ManyManyList; use SilverStripe\ORM\SS_List; use SilverStripe\ORM\SS_Map; use SilverStripe\View\ViewableData; -use Exception; /** * Allows grid field rows to be re-ordered via drag and drop. Both normal data @@ -363,7 +363,7 @@ class GridFieldOrderableRows extends RequestHandler implements */ public function handleMoveToPage(GridField $grid, $request) { - if (!$paginator = $grid->getConfig()->getComponentByType('SilverStripe\\Forms\\GridField\\GridFieldPaginator')) { + if (!$paginator = $grid->getConfig()->getComponentByType(GridFieldPaginator::class)) { $this->httpError(404, 'Paginator component not found'); }