Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Commit

Permalink
Merge pull request #984 from webstacknl/php-cs-fixer-3
Browse files Browse the repository at this point in the history
deps: Updated php-cs-fixer to ^3.6
  • Loading branch information
Seb33300 authored Feb 25, 2022
2 parents dfd8a4c + cd8846d commit a9f18ef
Show file tree
Hide file tree
Showing 17 changed files with 62 additions and 98 deletions.
8 changes: 2 additions & 6 deletions .php_cs.dist → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
->append([__DIR__.'/php-cs-fixer'])
;

$config = PhpCsFixer\Config::create()
return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PHP56Migration' => true,
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' => true,
'@PHPUnit60Migration:risky' => true,
Expand All @@ -31,7 +30,4 @@
'no_useless_return' => true,
'not_operator_with_successor_space' => true,
])
->setFinder($finder)
;

return $config;
->setFinder($finder);
4 changes: 2 additions & 2 deletions Datatable/AbstractDatatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ public function __construct(
$this->authorizationChecker = $authorizationChecker;
$this->securityToken = $securityToken;

if (!($translator instanceof LegacyTranslatorInterface) && !($translator instanceof TranslatorInterface)) {
throw new \InvalidArgumentException(sprintf('The $translator argument of %s must be an instance of %s or %s, a %s was given.', static::class, LegacyTranslatorInterface::class, TranslatorInterface::class, get_class($translator)));
if (! ($translator instanceof LegacyTranslatorInterface) && ! ($translator instanceof TranslatorInterface)) {
throw new \InvalidArgumentException(sprintf('The $translator argument of %s must be an instance of %s or %s, a %s was given.', static::class, LegacyTranslatorInterface::class, TranslatorInterface::class, \get_class($translator)));
}
$this->translator = $translator;
$this->router = $router;
Expand Down
10 changes: 5 additions & 5 deletions Datatable/Action/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@

class Action
{
use OptionsTrait;

// Render an Action only if conditions are TRUE.
use RenderIfTrait;

/*
* An Action has a 'start_html' and a 'end_html' option.
* <startHtml>action</endHtml>
*/
use HtmlContainerTrait;

use OptionsTrait;

// Render an Action only if conditions are TRUE.
use RenderIfTrait;

/**
* The name of the Action route.
* Default: null.
Expand Down
12 changes: 6 additions & 6 deletions Datatable/Column/AbstractColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,34 @@

abstract class AbstractColumn implements ColumnInterface
{
use OptionsTrait;

// Use an 'add_if' option to check in ColumnBuilder if the Column can be added.
use AddIfTrait;

use OptionsTrait;

//-------------------------------------------------
// Column Types
//-------------------------------------------------

/**
* Identifies a Data Column.
*/
const DATA_COLUMN = 'data';
public const DATA_COLUMN = 'data';

/**
* Identifies an Action Column.
*/
const ACTION_COLUMN = 'action';
public const ACTION_COLUMN = 'action';

/**
* Identifies a Multiselect Column.
*/
const MULTISELECT_COLUMN = 'multiselect';
public const MULTISELECT_COLUMN = 'multiselect';

/**
* Identifies a Virtual Column.
*/
const VIRTUAL_COLUMN = 'virtual';
public const VIRTUAL_COLUMN = 'virtual';

//--------------------------------------------------------------------------------------------------
// DataTables - Columns Options
Expand Down
4 changes: 2 additions & 2 deletions Datatable/Column/BooleanColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ class BooleanColumn extends AbstractColumn
/**
* @internal
*/
const RENDER_TRUE_VALUE = 'true';
public const RENDER_TRUE_VALUE = 'true';

/**
* @internal
*/
const RENDER_FALSE_VALUE = 'false';
public const RENDER_FALSE_VALUE = 'false';

/**
* The icon for a value that is true.
Expand Down
2 changes: 1 addition & 1 deletion Datatable/Column/ColumnInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface ColumnInterface
/**
* @var int
*/
const LAST_POSITION = -1;
public const LAST_POSITION = -1;

/**
* Validates $dql. Normally a non-empty string is expected.
Expand Down
2 changes: 1 addition & 1 deletion Datatable/Column/NumberColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function getFormatter()
/**
* @return $this
*/
public function setFormatter(\NumberFormatter $formatter)
public function setFormatter(\NumberFormatter $formatter)
{
$this->formatter = $formatter;

Expand Down
4 changes: 2 additions & 2 deletions Datatable/DatatableFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public function __construct(
$this->authorizationChecker = $authorizationChecker;
$this->securityToken = $securityToken;

if (!($translator instanceof LegacyTranslatorInterface) && !($translator instanceof TranslatorInterface)) {
throw new \InvalidArgumentException(sprintf('The $translator argument of %s must be an instance of %s or %s, a %s was given.', static::class, LegacyTranslatorInterface::class, TranslatorInterface::class, get_class($translator)));
if (! ($translator instanceof LegacyTranslatorInterface) && ! ($translator instanceof TranslatorInterface)) {
throw new \InvalidArgumentException(sprintf('The $translator argument of %s must be an instance of %s or %s, a %s was given.', static::class, LegacyTranslatorInterface::class, TranslatorInterface::class, \get_class($translator)));
}
$this->translator = $translator;
$this->router = $router;
Expand Down
2 changes: 1 addition & 1 deletion Datatable/DatatableInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
interface DatatableInterface
{
const NAME_REGEX = '/^[a-zA-Z0-9\-\_]+$/';
public const NAME_REGEX = '/^[a-zA-Z0-9\-\_]+$/';

/**
* Builds the datatable.
Expand Down
4 changes: 1 addition & 3 deletions Datatable/Extension/Responsive.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ public function setDetails($details)
if (\is_array($details)) {
foreach ($details as $key => $value) {
if (false === \in_array($key, ['type', 'target', 'renderer', 'display'], true)) {
throw new Exception(
"Responsive::setDetails(): {$key} is not an valid option."
);
throw new Exception("Responsive::setDetails(): {$key} is not an valid option.");
}
}

Expand Down
36 changes: 9 additions & 27 deletions Datatable/Extension/RowGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,7 @@ public function getDataSrc()
public function setDataSrc($dataSrc)
{
if (\is_string($dataSrc) && empty($dataSrc)) {
throw new \Exception(
'RowGroup::setDataSrc(): the column name is empty.'
);
throw new \Exception('RowGroup::setDataSrc(): the column name is empty.');
}

$this->dataSrc = $dataSrc;
Expand All @@ -174,16 +172,12 @@ public function getStartRender()
public function setStartRender($startRender)
{
if (false === \array_key_exists('template', $startRender)) {
throw new Exception(
'RowGroup::setStartRender(): The "template" option is required.'
);
throw new Exception('RowGroup::setStartRender(): The "template" option is required.');
}

foreach ($startRender as $key => $value) {
if (false === \in_array($key, ['template', 'vars'], true)) {
throw new Exception(
"RowGroup::setStartRender(): {$key} is not a valid option."
);
throw new Exception("RowGroup::setStartRender(): {$key} is not a valid option.");
}
}

Expand All @@ -208,16 +202,12 @@ public function getEndRender()
public function setEndRender($endRender)
{
if (false === \array_key_exists('template', $endRender)) {
throw new Exception(
'RowGroup::setEndRender(): The "template" option is required.'
);
throw new Exception('RowGroup::setEndRender(): The "template" option is required.');
}

foreach ($endRender as $key => $value) {
if (false === \in_array($key, ['template', 'vars'], true)) {
throw new Exception(
"RowGroup::setEndRender(): {$key} is not a valid option."
);
throw new Exception("RowGroup::setEndRender(): {$key} is not a valid option.");
}
}

Expand All @@ -242,9 +232,7 @@ public function getClassName()
public function setClassName($className)
{
if (\is_string($className) && empty($className)) {
throw new \Exception(
'RowGroup::setClassName(): the class name is empty.'
);
throw new \Exception('RowGroup::setClassName(): the class name is empty.');
}

$this->className = $className;
Expand All @@ -268,9 +256,7 @@ public function getEmptyDataGroup()
public function setEmptyDataGroup($emptyDataGroup)
{
if (\is_string($emptyDataGroup) && empty($emptyDataGroup)) {
throw new \Exception(
'RowGroup::setEmptyDataGroup(): the empty data group text is empty.'
);
throw new \Exception('RowGroup::setEmptyDataGroup(): the empty data group text is empty.');
}

$this->emptyDataGroup = $emptyDataGroup;
Expand Down Expand Up @@ -314,9 +300,7 @@ public function getEndClassName()
public function setEndClassName($endClassName)
{
if (\is_string($endClassName) && empty($endClassName)) {
throw new \Exception(
'RowGroup::setEndClassName(): the end class name is empty.'
);
throw new \Exception('RowGroup::setEndClassName(): the end class name is empty.');
}

$this->endClassName = $endClassName;
Expand All @@ -340,9 +324,7 @@ public function getStartClassName()
public function setStartClassName($startClassName)
{
if (\is_string($startClassName) && empty($startClassName)) {
throw new \Exception(
'RowGroup::setStartClassName(): the start class name is empty.'
);
throw new \Exception('RowGroup::setStartClassName(): the start class name is empty.');
}

$this->startClassName = $startClassName;
Expand Down
8 changes: 2 additions & 6 deletions Datatable/OptionsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,12 @@ protected function optionToJson($value)
protected function validateArrayForTemplateAndOther(array $array, array $other = ['template', 'vars'])
{
if (false === \array_key_exists('template', $array)) {
throw new Exception(
'OptionsTrait::validateArrayForTemplateAndOther(): The "template" option is required.'
);
throw new Exception('OptionsTrait::validateArrayForTemplateAndOther(): The "template" option is required.');
}

foreach ($array as $key => $value) {
if (false === \in_array($key, $other, true)) {
throw new Exception(
"OptionsTrait::validateArrayForTemplateAndOther(): {$key} is not an valid option."
);
throw new Exception("OptionsTrait::validateArrayForTemplateAndOther(): {$key} is not an valid option.");
}
}

Expand Down
Loading

0 comments on commit a9f18ef

Please sign in to comment.