Fix PSR-2 rule violations and incorrect docblock return type

This commit is contained in:
Robbie Averill 2018-01-26 13:40:06 +13:00
parent b29db7a4e7
commit 24db0da047
2 changed files with 13 additions and 10 deletions

View File

@ -5,8 +5,8 @@ namespace Symbiote\GridFieldExtensions;
use Exception; use Exception;
use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Config\Configurable;
use SilverStripe\Forms\GridField\GridField; use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldPaginator;
use SilverStripe\Forms\GridField\GridField_FormAction; use SilverStripe\Forms\GridField\GridField_FormAction;
use SilverStripe\Forms\GridField\GridFieldPaginator;
use SilverStripe\Forms\GridField\GridState_Data; use SilverStripe\Forms\GridField\GridState_Data;
use SilverStripe\ORM\ArrayList; use SilverStripe\ORM\ArrayList;
use SilverStripe\ORM\Limitable; use SilverStripe\ORM\Limitable;
@ -269,7 +269,7 @@ class GridFieldConfigurablePaginator extends GridFieldPaginator
* {@inheritDoc} * {@inheritDoc}
* *
* @param GridField $gridField * @param GridField $gridField
* @return ArrayList|null * @return ArrayData|null
*/ */
public function getTemplateParameters(GridField $gridField) public function getTemplateParameters(GridField $gridField)
{ {
@ -281,7 +281,7 @@ class GridFieldConfigurablePaginator extends GridFieldPaginator
// Figure out which page and record range we're on // Figure out which page and record range we're on
if (!$arguments['total-rows']) { if (!$arguments['total-rows']) {
return; return null;
} }
// Define a list of the FormActions that should be generated for pager controls (see getPagerActions()) // 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( 'first' => array(
'title' => 'First', 'title' => 'First',
'args' => array('first-shown' => 1), '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) 'disable-previous' => ($this->getCurrentPage() == 1)
), ),
'prev' => array( 'prev' => array(
'title' => 'Previous', 'title' => 'Previous',
'args' => array('first-shown' => $arguments['first-shown'] - $this->getItemsPerPage()), '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) 'disable-previous' => ($this->getCurrentPage() == 1)
), ),
'next' => array( 'next' => array(
@ -307,7 +309,8 @@ class GridFieldConfigurablePaginator extends GridFieldPaginator
'last' => array( 'last' => array(
'title' => 'Last', 'title' => 'Last',
'args' => array('first-shown' => ($this->getTotalPages() - 1) * $this->getItemsPerPage() + 1), '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']) 'disable-next' => ($this->getCurrentPage() == $arguments['total-pages'])
), ),
'pagesize' => array( 'pagesize' => array(

View File

@ -11,17 +11,17 @@ use SilverStripe\Forms\GridField\GridField_DataManipulator;
use SilverStripe\Forms\GridField\GridField_HTMLProvider; use SilverStripe\Forms\GridField\GridField_HTMLProvider;
use SilverStripe\Forms\GridField\GridField_SaveHandler; use SilverStripe\Forms\GridField\GridField_SaveHandler;
use SilverStripe\Forms\GridField\GridField_URLHandler; use SilverStripe\Forms\GridField\GridField_URLHandler;
use SilverStripe\Forms\GridField\GridFieldPaginator;
use SilverStripe\Forms\HiddenField; use SilverStripe\Forms\HiddenField;
use SilverStripe\ORM\ArrayList; use SilverStripe\ORM\ArrayList;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DB;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\DataObjectInterface;
use SilverStripe\ORM\DB;
use SilverStripe\ORM\ManyManyList; use SilverStripe\ORM\ManyManyList;
use SilverStripe\ORM\SS_List; use SilverStripe\ORM\SS_List;
use SilverStripe\ORM\SS_Map; use SilverStripe\ORM\SS_Map;
use SilverStripe\View\ViewableData; use SilverStripe\View\ViewableData;
use Exception;
/** /**
* Allows grid field rows to be re-ordered via drag and drop. Both normal data * 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) 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'); $this->httpError(404, 'Paginator component not found');
} }