Skip to content

Bump to php-cs-fixer v3.1 #5045

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/system/API/ResponseTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected function makeController(array $userConfig = [], string $uri = 'http://
}

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

protected $request;
Expand Down Expand Up @@ -524,7 +524,7 @@ public function testFormatByRequestNegotiateIfFormatIsNotJsonOrXML()
$request = new MockIncomingRequest($config, new URI($config->baseURL), null, new UserAgent());
$response = new MockResponse($config);

$controller = new class($request, $response) {
$controller = new class ($request, $response) {
use ResponseTrait;

protected $request;
Expand Down
4 changes: 2 additions & 2 deletions tests/system/ControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function testConstructorHTTPS()
$original = $_SERVER;
$_SERVER = ['HTTPS' => 'on'];
// make sure we can instantiate one
$this->controller = new class() extends Controller {
$this->controller = new class () extends Controller {
protected $forceHTTPS = 1;
};
$this->controller->initController($this->request, $this->response, $this->logger);
Expand Down Expand Up @@ -169,7 +169,7 @@ public function testValidateWithStringRulesFoundUseMessagesParameter()

public function testHelpers()
{
$this->controller = new class() extends Controller {
$this->controller = new class () extends Controller {
protected $helpers = [
'cookie',
'text',
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Database/Live/GetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public function testGetRowWithReturnType()

public function testGetRowWithCustomReturnType()
{
$testClass = new class() {};
$testClass = new class () {};

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

Expand Down
2 changes: 1 addition & 1 deletion tests/system/Database/Migrations/MigrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected function setUp(): void

public function testDBGroup()
{
$migration = new class() extends Migration {
$migration = new class () extends Migration {
protected $DBGroup = 'tests';

public function up()
Expand Down
14 changes: 7 additions & 7 deletions tests/system/Entity/EntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ public function testAsArraySwapped()

public function testToArraySkipAttributesWithUnderscoreInFirstCharacter()
{
$entity = new class() extends Entity {
$entity = new class () extends Entity {
protected $attributes = [
'_foo' => null,
'bar' => null,
Expand Down Expand Up @@ -923,7 +923,7 @@ public function testJsonSerializableEntity()

protected function getEntity()
{
return new class() extends Entity {
return new class () extends Entity {
protected $attributes = [
'foo' => null,
'bar' => null,
Expand Down Expand Up @@ -963,7 +963,7 @@ public function getFakeBar()

protected function getMappedEntity()
{
return new class() extends Entity {
return new class () extends Entity {
protected $attributes = [
'foo' => null,
'simple' => null,
Expand Down Expand Up @@ -994,7 +994,7 @@ protected function getSimple()

protected function getSwappedEntity()
{
return new class() extends Entity {
return new class () extends Entity {
protected $attributes = [
'foo' => 'foo',
'bar' => 'bar',
Expand All @@ -1015,7 +1015,7 @@ protected function getSwappedEntity()

protected function getCastEntity($data = null): Entity
{
return new class($data) extends Entity {
return new class ($data) extends Entity {
protected $attributes = [
'first' => null,
'second' => null,
Expand Down Expand Up @@ -1074,7 +1074,7 @@ public function setSeventh($seventh)

protected function getCastNullableEntity()
{
return new class() extends Entity {
return new class () extends Entity {
protected $attributes = [
'string_null' => null,
'string_empty' => null,
Expand Down Expand Up @@ -1104,7 +1104,7 @@ protected function getCastNullableEntity()

protected function getCustomCastEntity()
{
return new class() extends Entity {
return new class () extends Entity {
protected $attributes = [
'first' => null,
'second' => null,
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Events/EventsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public function testHandleEventCallableInternalFunc()

public function testHandleEventCallableClass()
{
$box = new class() {
$box = new class () {
public $logged;

public function hold(string $value)
Expand Down
4 changes: 2 additions & 2 deletions tests/system/Models/GeneralModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function testSetAllowedFields(): void
'updated_at',
];

$model = new class() extends Model {
$model = new class () extends Model {
protected $allowedFields = [
'id',
'created_at',
Expand Down Expand Up @@ -147,7 +147,7 @@ public function testBuilderWithParameterIgnoresShared(): void

public function testInitialize(): void
{
$model = new class() extends Model {
$model = new class () extends Model {
/**
* @var bool
*/
Expand Down
4 changes: 2 additions & 2 deletions tests/system/Models/InsertModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function testInsertResultFail(): void

public function testInsertBatchNewEntityWithDateTime(): void
{
$entity = new class() extends Entity {
$entity = new class () extends Entity {
protected $id;
protected $name;
protected $email;
Expand Down Expand Up @@ -215,7 +215,7 @@ public function testInsertEntityWithNoDataExceptionNoAllowedData(): void
{
$this->createModel(UserModel::class);

$entity = new class() extends Entity {
$entity = new class () extends Entity {
protected $id;
protected $name;
protected $email;
Expand Down
6 changes: 3 additions & 3 deletions tests/system/Models/SaveModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public function testEmptySaveData(): void

public function testSaveNewEntityWithDateTime(): void
{
$entity = new class() extends Entity {
$entity = new class () extends Entity {
protected $id;
protected $name;
protected $email;
Expand Down Expand Up @@ -242,7 +242,7 @@ public function testSaveNewEntityWithDateTime(): void

public function testSaveNewEntityWithDate(): void
{
$entity = new class() extends Entity {
$entity = new class () extends Entity {
protected $id;
protected $name;
protected $created_at;
Expand All @@ -258,7 +258,7 @@ public function testSaveNewEntityWithDate(): void
];
};

$testModel = new class() extends Model {
$testModel = new class () extends Model {
protected $table = 'empty';
protected $allowedFields = [
'name',
Expand Down
6 changes: 3 additions & 3 deletions tests/system/Models/UpdateModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public function testUpdateBatchValidationFail(): void

public function testUpdateBatchWithEntity(): void
{
$entity1 = new class() extends Entity {
$entity1 = new class () extends Entity {
protected $id;
protected $name;
protected $email;
Expand All @@ -178,7 +178,7 @@ public function testUpdateBatchWithEntity(): void
];
};

$entity2 = new class() extends Entity {
$entity2 = new class () extends Entity {
protected $id;
protected $name;
protected $email;
Expand Down Expand Up @@ -307,7 +307,7 @@ public function testUpdateWithEntityNoAllowedFields(): void
{
$this->createModel(UserModel::class);

$entity = new class() extends Entity {
$entity = new class () extends Entity {
protected $id;
protected $name;
protected $email;
Expand Down
4 changes: 2 additions & 2 deletions tests/system/View/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public function testParseLoopObjectProperties()

public function testParseLoopEntityProperties()
{
$power = new class() extends Entity {
$power = new class () extends Entity {
public $foo = 'bar';
protected $bar = 'baz';

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

public function testParseLoopEntityObjectProperties()
{
$power = new class() extends Entity {
$power = new class () extends Entity {
protected $attributes = [
'foo' => 'bar',
'bar' => 'baz',
Expand Down
7 changes: 4 additions & 3 deletions utils/PhpCsFixer/CodeIgniter4.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,15 @@ public function __construct()
'cast_spaces' => ['space' => 'single'],
'class_attributes_separation' => [
'elements' => [
// 'const' => 'one_if_phpdoc', // @todo Enable in php-cs-fixer v3.1
// 'property' => 'one_if_phpdoc', // @todo Enable in php-cs-fixer v3.1
'method' => 'one',
],
],
'class_definition' => [
'multi_line_extends_each_single_line' => true,
'single_item_single_line' => true,
'single_line' => true,
'space_before_parenthesis' => true,
],
'class_keyword_remove' => false,
'clean_namespace' => true,
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
Expand All @@ -103,6 +101,7 @@ public function __construct()
'constant_case' => ['case' => 'lower'],
'date_time_immutable' => false,
'declare_equal_normalize' => ['space' => 'none'],
'declare_parentheses' => true,
'declare_strict_types' => false,
'dir_constant' => true,
'doctrine_annotation_array_assignment' => false,
Expand All @@ -115,6 +114,7 @@ public function __construct()
'shorten_simple_statements_only' => false,
],
'elseif' => true,
'empty_loop_body' => ['style' => 'braces'],
'encoding' => true,
'ereg_to_preg' => true,
'error_suppression' => [
Expand Down Expand Up @@ -519,6 +519,7 @@ public function __construct()
'elements' => ['arrays'],
],
'trim_array_spaces' => true,
'types_spaces' => ['space' => 'none'],
'unary_operator_spaces' => true,
'use_arrow_functions' => false, // requires PHP7.4+
'visibility_required' => ['elements' => ['const', 'method', 'property']],
Expand Down