From 23b47b2aeb81ffcbe4d6d7d457de91e6ff2f24cc Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Wed, 18 Mar 2020 16:40:07 +0000 Subject: [PATCH] [CS-FIXER] Updated cs-fixer rules and added a temporary exception to the src/Entity folder (awaiting pr merge) --- .php_cs | 16 ++++++++++----- src/Entity/User.php | 49 --------------------------------------------- 2 files changed, 11 insertions(+), 54 deletions(-) diff --git a/.php_cs b/.php_cs index 822d6b4d87..4a0da91b03 100644 --- a/.php_cs +++ b/.php_cs @@ -13,7 +13,10 @@ return PhpCsFixer\Config::create() // PHP arrays should be declared using the configured syntax. 'array_syntax' => ['syntax' => 'short'], // Binary operators should be surrounded by space as configured. - 'binary_operator_spaces' => ['default' => 'align_single_space_minimal'], + 'binary_operator_spaces' => [ + 'default' => 'align_single_space_minimal', + 'operators' => ['??' => 'align'], + ], // There MUST be one blank line after the namespace declaration. 'blank_line_after_namespace' => true, // Each element of an array must be indented exactly once. @@ -21,11 +24,13 @@ return PhpCsFixer\Config::create() // Ensure there is no code on the same line as the PHP open tag and it is followed by a blank line. 'blank_line_after_opening_tag' => true, // The body of each structure MUST be enclosed by braces. Braces should be properly placed. Body of braces should be properly indented. - 'braces' => ['allow_single_line_closure' => true, 'position_after_functions_and_oop_constructs' => 'next'], + 'braces' => ['allow_single_line_closure' => true, 'position_after_functions_and_oop_constructs' => 'next', + // 'allow_single_line_functions' => true, // Awaiting PR merge... + ], // A single space or none should be between cast and variable. 'cast_spaces' => true, // Class, trait and interface elements must be separated with one blank line. - 'class_attributes_separation' => true, + 'class_attributes_separation' => false, // Whitespace around the keywords of a class, trait or interfaces definition should be one space. 'class_definition' => ['single_item_single_line' => true, 'single_line' => true], // Using `isset($var) &&` multiple times should be done in one call. @@ -145,7 +150,7 @@ return PhpCsFixer\Config::create() // In function arguments there must not be arguments with default values before non-default ones. 'no_unreachable_default_argument_value' => true, // Variables must be set `null` instead of using `(unset)` casting. - 'no_unset_cast' => true, + 'no_unset_cast' => false, // Properties should be set to `null` instead of using `unset`. 'no_unset_on_property' => true, // Unused `use` statements must be removed. @@ -205,7 +210,7 @@ return PhpCsFixer\Config::create() // Annotations in PHPDoc should be grouped together so that annotations of the same type immediately follow each other, and annotations of a different type are separated by a single blank line. 'phpdoc_separation' => true, // Single line `@var` PHPDoc should have proper spacing. - 'phpdoc_single_line_var_spacing' => true, + 'phpdoc_single_line_var_spacing' => false, // Removes extra blank lines after summary and after description in PHPDoc. 'phpdoc_trim_consecutive_blank_line_separation' => true, // The correct case must be used for standard PHP types in PHPDoc. @@ -266,5 +271,6 @@ return PhpCsFixer\Config::create() ->setFinder(PhpCsFixer\Finder::create() ->exclude('vendor') ->exclude('var') + ->exclude('src/Entity') ->in(__DIR__) ); diff --git a/src/Entity/User.php b/src/Entity/User.php index be2473a070..5e52db9bc7 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -7,53 +7,29 @@ class User // AUTOCODE BEGIN private int $id; - private ?string $nickname; - private ?string $password; - private ?string $email; - private ?string $incomingemail; - private ?bool $emailnotifysub; - private ?int $emailnotifyfav; - private ?bool $emailnotifynudge; - private ?bool $emailnotifymsg; - private ?bool $emailnotifyattn; - private ?string $language; - private ?string $timezone; - private ?bool $emailpost; - private ?string $sms; - private ?int $carrier; - private ?bool $smsnotify; - private ?bool $smsreplies; - private ?string $smsemail; - private ?string $uri; - private ?bool $autosubscribe; - private ?int $subscribe_policy; - private ?string $urlshorteningservice; - private ?bool $private_stream; - private DateTime $created; - private DateTime $modified; public function setId(int $id): self @@ -61,7 +37,6 @@ class User $this->id = $id; return $this; } - public function getId(): int { return $this->id; @@ -72,7 +47,6 @@ class User $this->nickname = $nickname; return $this; } - public function getNickname(): ?string { return $this->nickname; @@ -83,7 +57,6 @@ class User $this->password = $password; return $this; } - public function getPassword(): ?string { return $this->password; @@ -94,7 +67,6 @@ class User $this->email = $email; return $this; } - public function getEmail(): ?string { return $this->email; @@ -105,7 +77,6 @@ class User $this->incomingemail = $incomingemail; return $this; } - public function getIncomingemail(): ?string { return $this->incomingemail; @@ -116,7 +87,6 @@ class User $this->emailnotifysub = $emailnotifysub; return $this; } - public function getEmailnotifysub(): ?bool { return $this->emailnotifysub; @@ -127,7 +97,6 @@ class User $this->emailnotifyfav = $emailnotifyfav; return $this; } - public function getEmailnotifyfav(): ?int { return $this->emailnotifyfav; @@ -138,7 +107,6 @@ class User $this->emailnotifynudge = $emailnotifynudge; return $this; } - public function getEmailnotifynudge(): ?bool { return $this->emailnotifynudge; @@ -149,7 +117,6 @@ class User $this->emailnotifymsg = $emailnotifymsg; return $this; } - public function getEmailnotifymsg(): ?bool { return $this->emailnotifymsg; @@ -160,7 +127,6 @@ class User $this->emailnotifyattn = $emailnotifyattn; return $this; } - public function getEmailnotifyattn(): ?bool { return $this->emailnotifyattn; @@ -171,7 +137,6 @@ class User $this->language = $language; return $this; } - public function getLanguage(): ?string { return $this->language; @@ -182,7 +147,6 @@ class User $this->timezone = $timezone; return $this; } - public function getTimezone(): ?string { return $this->timezone; @@ -193,7 +157,6 @@ class User $this->emailpost = $emailpost; return $this; } - public function getEmailpost(): ?bool { return $this->emailpost; @@ -204,7 +167,6 @@ class User $this->sms = $sms; return $this; } - public function getSms(): ?string { return $this->sms; @@ -215,7 +177,6 @@ class User $this->carrier = $carrier; return $this; } - public function getCarrier(): ?int { return $this->carrier; @@ -226,7 +187,6 @@ class User $this->smsnotify = $smsnotify; return $this; } - public function getSmsnotify(): ?bool { return $this->smsnotify; @@ -237,7 +197,6 @@ class User $this->smsreplies = $smsreplies; return $this; } - public function getSmsreplies(): ?bool { return $this->smsreplies; @@ -248,7 +207,6 @@ class User $this->smsemail = $smsemail; return $this; } - public function getSmsemail(): ?string { return $this->smsemail; @@ -259,7 +217,6 @@ class User $this->uri = $uri; return $this; } - public function getUri(): ?string { return $this->uri; @@ -270,7 +227,6 @@ class User $this->autosubscribe = $autosubscribe; return $this; } - public function getAutosubscribe(): ?bool { return $this->autosubscribe; @@ -281,7 +237,6 @@ class User $this->subscribe_policy = $subscribe_policy; return $this; } - public function getSubscribePolicy(): ?int { return $this->subscribe_policy; @@ -292,7 +247,6 @@ class User $this->urlshorteningservice = $urlshorteningservice; return $this; } - public function getUrlshorteningservice(): ?string { return $this->urlshorteningservice; @@ -303,7 +257,6 @@ class User $this->private_stream = $private_stream; return $this; } - public function getPrivateStream(): ?bool { return $this->private_stream; @@ -314,7 +267,6 @@ class User $this->created = $created; return $this; } - public function getCreated(): DateTime { return $this->created; @@ -325,7 +277,6 @@ class User $this->modified = $modified; return $this; } - public function getModified(): DateTime { return $this->modified;