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

Commit a9f18ef

Browse files
authored
Merge pull request #984 from webstacknl/php-cs-fixer-3
deps: Updated php-cs-fixer to ^3.6
2 parents dfd8a4c + cd8846d commit a9f18ef

17 files changed

+62
-98
lines changed

.php_cs.dist .php-cs-fixer.dist.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515
->append([__DIR__.'/php-cs-fixer'])
1616
;
1717

18-
$config = PhpCsFixer\Config::create()
18+
return (new PhpCsFixer\Config())
1919
->setRiskyAllowed(true)
2020
->setRules([
21-
'@PHP56Migration' => true,
2221
'@PhpCsFixer' => true,
2322
'@PhpCsFixer:risky' => true,
2423
'@PHPUnit60Migration:risky' => true,
@@ -31,7 +30,4 @@
3130
'no_useless_return' => true,
3231
'not_operator_with_successor_space' => true,
3332
])
34-
->setFinder($finder)
35-
;
36-
37-
return $config;
33+
->setFinder($finder);

Datatable/AbstractDatatable.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ public function __construct(
168168
$this->authorizationChecker = $authorizationChecker;
169169
$this->securityToken = $securityToken;
170170

171-
if (!($translator instanceof LegacyTranslatorInterface) && !($translator instanceof TranslatorInterface)) {
172-
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)));
171+
if (! ($translator instanceof LegacyTranslatorInterface) && ! ($translator instanceof TranslatorInterface)) {
172+
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)));
173173
}
174174
$this->translator = $translator;
175175
$this->router = $router;

Datatable/Action/Action.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@
2020

2121
class Action
2222
{
23-
use OptionsTrait;
24-
25-
// Render an Action only if conditions are TRUE.
26-
use RenderIfTrait;
27-
2823
/*
2924
* An Action has a 'start_html' and a 'end_html' option.
3025
* <startHtml>action</endHtml>
3126
*/
3227
use HtmlContainerTrait;
3328

29+
use OptionsTrait;
30+
31+
// Render an Action only if conditions are TRUE.
32+
use RenderIfTrait;
33+
3434
/**
3535
* The name of the Action route.
3636
* Default: null.

Datatable/Column/AbstractColumn.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -23,34 +23,34 @@
2323

2424
abstract class AbstractColumn implements ColumnInterface
2525
{
26-
use OptionsTrait;
27-
2826
// Use an 'add_if' option to check in ColumnBuilder if the Column can be added.
2927
use AddIfTrait;
3028

29+
use OptionsTrait;
30+
3131
//-------------------------------------------------
3232
// Column Types
3333
//-------------------------------------------------
3434

3535
/**
3636
* Identifies a Data Column.
3737
*/
38-
const DATA_COLUMN = 'data';
38+
public const DATA_COLUMN = 'data';
3939

4040
/**
4141
* Identifies an Action Column.
4242
*/
43-
const ACTION_COLUMN = 'action';
43+
public const ACTION_COLUMN = 'action';
4444

4545
/**
4646
* Identifies a Multiselect Column.
4747
*/
48-
const MULTISELECT_COLUMN = 'multiselect';
48+
public const MULTISELECT_COLUMN = 'multiselect';
4949

5050
/**
5151
* Identifies a Virtual Column.
5252
*/
53-
const VIRTUAL_COLUMN = 'virtual';
53+
public const VIRTUAL_COLUMN = 'virtual';
5454

5555
//--------------------------------------------------------------------------------------------------
5656
// DataTables - Columns Options

Datatable/Column/BooleanColumn.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ class BooleanColumn extends AbstractColumn
2626
/**
2727
* @internal
2828
*/
29-
const RENDER_TRUE_VALUE = 'true';
29+
public const RENDER_TRUE_VALUE = 'true';
3030

3131
/**
3232
* @internal
3333
*/
34-
const RENDER_FALSE_VALUE = 'false';
34+
public const RENDER_FALSE_VALUE = 'false';
3535

3636
/**
3737
* The icon for a value that is true.

Datatable/Column/ColumnInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ interface ColumnInterface
1919
/**
2020
* @var int
2121
*/
22-
const LAST_POSITION = -1;
22+
public const LAST_POSITION = -1;
2323

2424
/**
2525
* Validates $dql. Normally a non-empty string is expected.

Datatable/Column/NumberColumn.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public function getFormatter()
149149
/**
150150
* @return $this
151151
*/
152-
public function setFormatter(\NumberFormatter $formatter)
152+
public function setFormatter(\NumberFormatter $formatter)
153153
{
154154
$this->formatter = $formatter;
155155

Datatable/DatatableFactory.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ public function __construct(
7575
$this->authorizationChecker = $authorizationChecker;
7676
$this->securityToken = $securityToken;
7777

78-
if (!($translator instanceof LegacyTranslatorInterface) && !($translator instanceof TranslatorInterface)) {
79-
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)));
78+
if (! ($translator instanceof LegacyTranslatorInterface) && ! ($translator instanceof TranslatorInterface)) {
79+
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)));
8080
}
8181
$this->translator = $translator;
8282
$this->router = $router;

Datatable/DatatableInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
interface DatatableInterface
2121
{
22-
const NAME_REGEX = '/^[a-zA-Z0-9\-\_]+$/';
22+
public const NAME_REGEX = '/^[a-zA-Z0-9\-\_]+$/';
2323

2424
/**
2525
* Builds the datatable.

Datatable/Extension/Responsive.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ public function setDetails($details)
7676
if (\is_array($details)) {
7777
foreach ($details as $key => $value) {
7878
if (false === \in_array($key, ['type', 'target', 'renderer', 'display'], true)) {
79-
throw new Exception(
80-
"Responsive::setDetails(): {$key} is not an valid option."
81-
);
79+
throw new Exception("Responsive::setDetails(): {$key} is not an valid option.");
8280
}
8381
}
8482

Datatable/Extension/RowGroup.php

+9-27
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,7 @@ public function getDataSrc()
148148
public function setDataSrc($dataSrc)
149149
{
150150
if (\is_string($dataSrc) && empty($dataSrc)) {
151-
throw new \Exception(
152-
'RowGroup::setDataSrc(): the column name is empty.'
153-
);
151+
throw new \Exception('RowGroup::setDataSrc(): the column name is empty.');
154152
}
155153

156154
$this->dataSrc = $dataSrc;
@@ -174,16 +172,12 @@ public function getStartRender()
174172
public function setStartRender($startRender)
175173
{
176174
if (false === \array_key_exists('template', $startRender)) {
177-
throw new Exception(
178-
'RowGroup::setStartRender(): The "template" option is required.'
179-
);
175+
throw new Exception('RowGroup::setStartRender(): The "template" option is required.');
180176
}
181177

182178
foreach ($startRender as $key => $value) {
183179
if (false === \in_array($key, ['template', 'vars'], true)) {
184-
throw new Exception(
185-
"RowGroup::setStartRender(): {$key} is not a valid option."
186-
);
180+
throw new Exception("RowGroup::setStartRender(): {$key} is not a valid option.");
187181
}
188182
}
189183

@@ -208,16 +202,12 @@ public function getEndRender()
208202
public function setEndRender($endRender)
209203
{
210204
if (false === \array_key_exists('template', $endRender)) {
211-
throw new Exception(
212-
'RowGroup::setEndRender(): The "template" option is required.'
213-
);
205+
throw new Exception('RowGroup::setEndRender(): The "template" option is required.');
214206
}
215207

216208
foreach ($endRender as $key => $value) {
217209
if (false === \in_array($key, ['template', 'vars'], true)) {
218-
throw new Exception(
219-
"RowGroup::setEndRender(): {$key} is not a valid option."
220-
);
210+
throw new Exception("RowGroup::setEndRender(): {$key} is not a valid option.");
221211
}
222212
}
223213

@@ -242,9 +232,7 @@ public function getClassName()
242232
public function setClassName($className)
243233
{
244234
if (\is_string($className) && empty($className)) {
245-
throw new \Exception(
246-
'RowGroup::setClassName(): the class name is empty.'
247-
);
235+
throw new \Exception('RowGroup::setClassName(): the class name is empty.');
248236
}
249237

250238
$this->className = $className;
@@ -268,9 +256,7 @@ public function getEmptyDataGroup()
268256
public function setEmptyDataGroup($emptyDataGroup)
269257
{
270258
if (\is_string($emptyDataGroup) && empty($emptyDataGroup)) {
271-
throw new \Exception(
272-
'RowGroup::setEmptyDataGroup(): the empty data group text is empty.'
273-
);
259+
throw new \Exception('RowGroup::setEmptyDataGroup(): the empty data group text is empty.');
274260
}
275261

276262
$this->emptyDataGroup = $emptyDataGroup;
@@ -314,9 +300,7 @@ public function getEndClassName()
314300
public function setEndClassName($endClassName)
315301
{
316302
if (\is_string($endClassName) && empty($endClassName)) {
317-
throw new \Exception(
318-
'RowGroup::setEndClassName(): the end class name is empty.'
319-
);
303+
throw new \Exception('RowGroup::setEndClassName(): the end class name is empty.');
320304
}
321305

322306
$this->endClassName = $endClassName;
@@ -340,9 +324,7 @@ public function getStartClassName()
340324
public function setStartClassName($startClassName)
341325
{
342326
if (\is_string($startClassName) && empty($startClassName)) {
343-
throw new \Exception(
344-
'RowGroup::setStartClassName(): the start class name is empty.'
345-
);
327+
throw new \Exception('RowGroup::setStartClassName(): the start class name is empty.');
346328
}
347329

348330
$this->startClassName = $startClassName;

Datatable/OptionsTrait.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,12 @@ protected function optionToJson($value)
9898
protected function validateArrayForTemplateAndOther(array $array, array $other = ['template', 'vars'])
9999
{
100100
if (false === \array_key_exists('template', $array)) {
101-
throw new Exception(
102-
'OptionsTrait::validateArrayForTemplateAndOther(): The "template" option is required.'
103-
);
101+
throw new Exception('OptionsTrait::validateArrayForTemplateAndOther(): The "template" option is required.');
104102
}
105103

106104
foreach ($array as $key => $value) {
107105
if (false === \in_array($key, $other, true)) {
108-
throw new Exception(
109-
"OptionsTrait::validateArrayForTemplateAndOther(): {$key} is not an valid option."
110-
);
106+
throw new Exception("OptionsTrait::validateArrayForTemplateAndOther(): {$key} is not an valid option.");
111107
}
112108
}
113109

0 commit comments

Comments
 (0)