Skip to content

Commit cca4660

Browse files
authored
Bump to php-cs-fixer v3.1 (#5045)
1 parent 0869c0d commit cca4660

File tree

12 files changed

+30
-29
lines changed

12 files changed

+30
-29
lines changed

tests/system/API/ResponseTraitTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected function makeController(array $userConfig = [], string $uri = 'http://
8282
}
8383

8484
// Create the controller class finally.
85-
$controller = new class($this->request, $this->response, $this->formatter) {
85+
$controller = new class ($this->request, $this->response, $this->formatter) {
8686
use ResponseTrait;
8787

8888
protected $request;
@@ -524,7 +524,7 @@ public function testFormatByRequestNegotiateIfFormatIsNotJsonOrXML()
524524
$request = new MockIncomingRequest($config, new URI($config->baseURL), null, new UserAgent());
525525
$response = new MockResponse($config);
526526

527-
$controller = new class($request, $response) {
527+
$controller = new class ($request, $response) {
528528
use ResponseTrait;
529529

530530
protected $request;

tests/system/ControllerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function testConstructorHTTPS()
8585
$original = $_SERVER;
8686
$_SERVER = ['HTTPS' => 'on'];
8787
// make sure we can instantiate one
88-
$this->controller = new class() extends Controller {
88+
$this->controller = new class () extends Controller {
8989
protected $forceHTTPS = 1;
9090
};
9191
$this->controller->initController($this->request, $this->response, $this->logger);
@@ -169,7 +169,7 @@ public function testValidateWithStringRulesFoundUseMessagesParameter()
169169

170170
public function testHelpers()
171171
{
172-
$this->controller = new class() extends Controller {
172+
$this->controller = new class () extends Controller {
173173
protected $helpers = [
174174
'cookie',
175175
'text',

tests/system/Database/Live/GetTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public function testGetRowWithReturnType()
227227

228228
public function testGetRowWithCustomReturnType()
229229
{
230-
$testClass = new class() {};
230+
$testClass = new class () {};
231231

232232
$user = $this->db->table('user')->get()->getRow(0, get_class($testClass));
233233

tests/system/Database/Migrations/MigrationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ protected function setUp(): void
2929

3030
public function testDBGroup()
3131
{
32-
$migration = new class() extends Migration {
32+
$migration = new class () extends Migration {
3333
protected $DBGroup = 'tests';
3434

3535
public function up()

tests/system/Entity/EntityTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ public function testAsArraySwapped()
762762

763763
public function testToArraySkipAttributesWithUnderscoreInFirstCharacter()
764764
{
765-
$entity = new class() extends Entity {
765+
$entity = new class () extends Entity {
766766
protected $attributes = [
767767
'_foo' => null,
768768
'bar' => null,
@@ -923,7 +923,7 @@ public function testJsonSerializableEntity()
923923

924924
protected function getEntity()
925925
{
926-
return new class() extends Entity {
926+
return new class () extends Entity {
927927
protected $attributes = [
928928
'foo' => null,
929929
'bar' => null,
@@ -963,7 +963,7 @@ public function getFakeBar()
963963

964964
protected function getMappedEntity()
965965
{
966-
return new class() extends Entity {
966+
return new class () extends Entity {
967967
protected $attributes = [
968968
'foo' => null,
969969
'simple' => null,
@@ -994,7 +994,7 @@ protected function getSimple()
994994

995995
protected function getSwappedEntity()
996996
{
997-
return new class() extends Entity {
997+
return new class () extends Entity {
998998
protected $attributes = [
999999
'foo' => 'foo',
10001000
'bar' => 'bar',
@@ -1015,7 +1015,7 @@ protected function getSwappedEntity()
10151015

10161016
protected function getCastEntity($data = null): Entity
10171017
{
1018-
return new class($data) extends Entity {
1018+
return new class ($data) extends Entity {
10191019
protected $attributes = [
10201020
'first' => null,
10211021
'second' => null,
@@ -1074,7 +1074,7 @@ public function setSeventh($seventh)
10741074

10751075
protected function getCastNullableEntity()
10761076
{
1077-
return new class() extends Entity {
1077+
return new class () extends Entity {
10781078
protected $attributes = [
10791079
'string_null' => null,
10801080
'string_empty' => null,
@@ -1104,7 +1104,7 @@ protected function getCastNullableEntity()
11041104

11051105
protected function getCustomCastEntity()
11061106
{
1107-
return new class() extends Entity {
1107+
return new class () extends Entity {
11081108
protected $attributes = [
11091109
'first' => null,
11101110
'second' => null,

tests/system/Events/EventsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ public function testHandleEventCallableInternalFunc()
280280

281281
public function testHandleEventCallableClass()
282282
{
283-
$box = new class() {
283+
$box = new class () {
284284
public $logged;
285285

286286
public function hold(string $value)

tests/system/Models/GeneralModelTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function testSetAllowedFields(): void
104104
'updated_at',
105105
];
106106

107-
$model = new class() extends Model {
107+
$model = new class () extends Model {
108108
protected $allowedFields = [
109109
'id',
110110
'created_at',
@@ -147,7 +147,7 @@ public function testBuilderWithParameterIgnoresShared(): void
147147

148148
public function testInitialize(): void
149149
{
150-
$model = new class() extends Model {
150+
$model = new class () extends Model {
151151
/**
152152
* @var bool
153153
*/

tests/system/Models/InsertModelTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public function testInsertResultFail(): void
157157

158158
public function testInsertBatchNewEntityWithDateTime(): void
159159
{
160-
$entity = new class() extends Entity {
160+
$entity = new class () extends Entity {
161161
protected $id;
162162
protected $name;
163163
protected $email;
@@ -215,7 +215,7 @@ public function testInsertEntityWithNoDataExceptionNoAllowedData(): void
215215
{
216216
$this->createModel(UserModel::class);
217217

218-
$entity = new class() extends Entity {
218+
$entity = new class () extends Entity {
219219
protected $id;
220220
protected $name;
221221
protected $email;

tests/system/Models/SaveModelTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public function testEmptySaveData(): void
208208

209209
public function testSaveNewEntityWithDateTime(): void
210210
{
211-
$entity = new class() extends Entity {
211+
$entity = new class () extends Entity {
212212
protected $id;
213213
protected $name;
214214
protected $email;
@@ -242,7 +242,7 @@ public function testSaveNewEntityWithDateTime(): void
242242

243243
public function testSaveNewEntityWithDate(): void
244244
{
245-
$entity = new class() extends Entity {
245+
$entity = new class () extends Entity {
246246
protected $id;
247247
protected $name;
248248
protected $created_at;
@@ -258,7 +258,7 @@ public function testSaveNewEntityWithDate(): void
258258
];
259259
};
260260

261-
$testModel = new class() extends Model {
261+
$testModel = new class () extends Model {
262262
protected $table = 'empty';
263263
protected $allowedFields = [
264264
'name',

tests/system/Models/UpdateModelTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public function testUpdateBatchValidationFail(): void
158158

159159
public function testUpdateBatchWithEntity(): void
160160
{
161-
$entity1 = new class() extends Entity {
161+
$entity1 = new class () extends Entity {
162162
protected $id;
163163
protected $name;
164164
protected $email;
@@ -178,7 +178,7 @@ public function testUpdateBatchWithEntity(): void
178178
];
179179
};
180180

181-
$entity2 = new class() extends Entity {
181+
$entity2 = new class () extends Entity {
182182
protected $id;
183183
protected $name;
184184
protected $email;
@@ -307,7 +307,7 @@ public function testUpdateWithEntityNoAllowedFields(): void
307307
{
308308
$this->createModel(UserModel::class);
309309

310-
$entity = new class() extends Entity {
310+
$entity = new class () extends Entity {
311311
protected $id;
312312
protected $name;
313313
protected $email;

tests/system/View/ParserTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public function testParseLoopObjectProperties()
262262

263263
public function testParseLoopEntityProperties()
264264
{
265-
$power = new class() extends Entity {
265+
$power = new class () extends Entity {
266266
public $foo = 'bar';
267267
protected $bar = 'baz';
268268

@@ -292,7 +292,7 @@ public function toArray(bool $onlyChanged = false, bool $cast = true, bool $recu
292292

293293
public function testParseLoopEntityObjectProperties()
294294
{
295-
$power = new class() extends Entity {
295+
$power = new class () extends Entity {
296296
protected $attributes = [
297297
'foo' => 'bar',
298298
'bar' => 'baz',

utils/PhpCsFixer/CodeIgniter4.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,15 @@ public function __construct()
7373
'cast_spaces' => ['space' => 'single'],
7474
'class_attributes_separation' => [
7575
'elements' => [
76-
// 'const' => 'one_if_phpdoc', // @todo Enable in php-cs-fixer v3.1
77-
// 'property' => 'one_if_phpdoc', // @todo Enable in php-cs-fixer v3.1
7876
'method' => 'one',
7977
],
8078
],
8179
'class_definition' => [
8280
'multi_line_extends_each_single_line' => true,
8381
'single_item_single_line' => true,
8482
'single_line' => true,
83+
'space_before_parenthesis' => true,
8584
],
86-
'class_keyword_remove' => false,
8785
'clean_namespace' => true,
8886
'combine_consecutive_issets' => true,
8987
'combine_consecutive_unsets' => true,
@@ -103,6 +101,7 @@ public function __construct()
103101
'constant_case' => ['case' => 'lower'],
104102
'date_time_immutable' => false,
105103
'declare_equal_normalize' => ['space' => 'none'],
104+
'declare_parentheses' => true,
106105
'declare_strict_types' => false,
107106
'dir_constant' => true,
108107
'doctrine_annotation_array_assignment' => false,
@@ -115,6 +114,7 @@ public function __construct()
115114
'shorten_simple_statements_only' => false,
116115
],
117116
'elseif' => true,
117+
'empty_loop_body' => ['style' => 'braces'],
118118
'encoding' => true,
119119
'ereg_to_preg' => true,
120120
'error_suppression' => [
@@ -519,6 +519,7 @@ public function __construct()
519519
'elements' => ['arrays'],
520520
],
521521
'trim_array_spaces' => true,
522+
'types_spaces' => ['space' => 'none'],
522523
'unary_operator_spaces' => true,
523524
'use_arrow_functions' => false, // requires PHP7.4+
524525
'visibility_required' => ['elements' => ['const', 'method', 'property']],

0 commit comments

Comments
 (0)