Skip to content

Commit 2b02f8c

Browse files
Unify and fix the coding style
Signed-off-by: Christoph Wurst <[email protected]>
1 parent 8c6527d commit 2b02f8c

File tree

259 files changed

+19942
-18740
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

259 files changed

+19942
-18740
lines changed

Diff for: .php_cs.cache

+1
Large diffs are not rendered by default.

Diff for: .php_cs.dist

+145
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
<?php
2+
3+
use PhpCsFixer\Config;
4+
use PhpCsFixer\Finder;
5+
6+
$rules = [
7+
'array_syntax' => ['syntax' => 'short'],
8+
'binary_operator_spaces' => [
9+
'default' => 'single_space',
10+
'operators' => ['=>' => null]
11+
],
12+
'blank_line_after_namespace' => true,
13+
'blank_line_after_opening_tag' => true,
14+
'blank_line_before_statement' => [
15+
'statements' => ['return']
16+
],
17+
'braces' => true,
18+
'cast_spaces' => true,
19+
'class_attributes_separation' => [
20+
'elements' => ['method']
21+
],
22+
'class_definition' => true,
23+
'concat_space' => [
24+
'spacing' => 'none'
25+
],
26+
'declare_equal_normalize' => true,
27+
'elseif' => true,
28+
'encoding' => true,
29+
'full_opening_tag' => true,
30+
'fully_qualified_strict_types' => true, // added by Shift
31+
'function_declaration' => true,
32+
'function_typehint_space' => true,
33+
'heredoc_to_nowdoc' => true,
34+
'include' => true,
35+
'increment_style' => ['style' => 'post'],
36+
'indentation_type' => true,
37+
'linebreak_after_opening_tag' => true,
38+
'line_ending' => true,
39+
'lowercase_cast' => true,
40+
'lowercase_constants' => true,
41+
'lowercase_keywords' => true,
42+
'lowercase_static_reference' => true, // added from Symfony
43+
'magic_method_casing' => true, // added from Symfony
44+
'magic_constant_casing' => true,
45+
'method_argument_space' => true,
46+
'native_function_casing' => true,
47+
'no_alias_functions' => true,
48+
'no_extra_blank_lines' => [
49+
'tokens' => [
50+
'extra',
51+
'throw',
52+
'use',
53+
'use_trait',
54+
]
55+
],
56+
'no_blank_lines_after_class_opening' => true,
57+
'no_blank_lines_after_phpdoc' => true,
58+
'no_closing_tag' => true,
59+
'no_empty_phpdoc' => true,
60+
'no_empty_statement' => true,
61+
'no_leading_import_slash' => true,
62+
'no_leading_namespace_whitespace' => true,
63+
'no_mixed_echo_print' => [
64+
'use' => 'echo'
65+
],
66+
'no_multiline_whitespace_around_double_arrow' => true,
67+
'multiline_whitespace_before_semicolons' => [
68+
'strategy' => 'no_multi_line'
69+
],
70+
'no_short_bool_cast' => true,
71+
'no_singleline_whitespace_before_semicolons' => true,
72+
'no_spaces_after_function_name' => true,
73+
'no_spaces_around_offset' => true,
74+
'no_spaces_inside_parenthesis' => true,
75+
'no_trailing_comma_in_list_call' => true,
76+
'no_trailing_comma_in_singleline_array' => true,
77+
'no_trailing_whitespace' => true,
78+
'no_trailing_whitespace_in_comment' => true,
79+
'no_unneeded_control_parentheses' => true,
80+
'no_unreachable_default_argument_value' => true,
81+
'no_useless_return' => true,
82+
'no_whitespace_before_comma_in_array' => true,
83+
'no_whitespace_in_blank_line' => true,
84+
'normalize_index_brace' => true,
85+
'not_operator_with_successor_space' => true,
86+
'object_operator_without_whitespace' => true,
87+
'ordered_imports' => ['sortAlgorithm' => 'alpha'],
88+
'phpdoc_indent' => true,
89+
'phpdoc_inline_tag' => true,
90+
'phpdoc_no_access' => true,
91+
'phpdoc_no_package' => true,
92+
'phpdoc_no_useless_inheritdoc' => true,
93+
'phpdoc_scalar' => true,
94+
'phpdoc_single_line_var_spacing' => true,
95+
'phpdoc_summary' => true,
96+
'phpdoc_to_comment' => true,
97+
'phpdoc_trim' => true,
98+
'phpdoc_types' => true,
99+
'phpdoc_var_without_name' => true,
100+
'psr4' => true,
101+
'self_accessor' => true,
102+
'short_scalar_cast' => true,
103+
'simplified_null_return' => false, // disabled by Shift
104+
'single_blank_line_at_eof' => true,
105+
'single_blank_line_before_namespace' => true,
106+
'single_class_element_per_statement' => true,
107+
'single_import_per_statement' => true,
108+
'single_line_after_imports' => true,
109+
'single_line_comment_style' => [
110+
'comment_types' => ['hash']
111+
],
112+
'single_quote' => true,
113+
'space_after_semicolon' => true,
114+
'standardize_not_equals' => true,
115+
'switch_case_semicolon_to_colon' => true,
116+
'switch_case_space' => true,
117+
'ternary_operator_spaces' => true,
118+
'trailing_comma_in_multiline_array' => true,
119+
'trim_array_spaces' => true,
120+
'unary_operator_spaces' => true,
121+
'visibility_required' => [
122+
'elements' => ['method', 'property']
123+
],
124+
'whitespace_after_comma_in_array' => true,
125+
];
126+
127+
$project_path = getcwd();
128+
$finder = Finder::create()
129+
->in([
130+
$project_path . '/app',
131+
$project_path . '/config',
132+
$project_path . '/database',
133+
$project_path . '/resources',
134+
$project_path . '/tests',
135+
])
136+
->name('*.php')
137+
->notName('*.blade.php')
138+
->ignoreDotFiles(true)
139+
->ignoreVCS(true);
140+
141+
return Config::create()
142+
->setFinder($finder)
143+
->setRules($rules)
144+
->setRiskyAllowed(true)
145+
->setUsingCache(true);

Diff for: app/AddressCatalogue.php

+8-10
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,18 @@
1616
*
1717
* You should have received a copy of the GNU Affero General Public License,version 3,
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>
19-
*
2019
*/
2120

2221
namespace App;
2322

2423
use Illuminate\Database\Eloquent\Model;
2524

26-
class AddressCatalogue extends Model {
27-
28-
/**
29-
* DB table name
30-
*
31-
* @var string
32-
*/
33-
protected $table = 'cat_address';
34-
25+
class AddressCatalogue extends Model
26+
{
27+
/**
28+
* DB table name.
29+
*
30+
* @var string
31+
*/
32+
protected $table = 'cat_address';
3533
}

Diff for: app/AdministrateModel.php

+9-10
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,19 @@
1616
*
1717
* You should have received a copy of the GNU Affero General Public License,version 3,
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>
19-
*
2019
*/
2120

2221
namespace App;
2322

2423
use App\MasterData\User;
2524

26-
interface AdministrateModel {
27-
28-
/**
29-
* Check if the given user is authorized to administrate the model instance
30-
*
31-
* @param User $user
32-
* @return bool
33-
*/
34-
public function administrates(User $user);
25+
interface AdministrateModel
26+
{
27+
/**
28+
* Check if the given user is authorized to administrate the model instance.
29+
*
30+
* @param User $user
31+
* @return bool
32+
*/
33+
public function administrates(User $user);
3534
}

Diff for: app/Auth/Abilities/ActivityLogAbilities.php

+6-7
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,16 @@
1616
*
1717
* You should have received a copy of the GNU Affero General Public License,version 3,
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>
19-
*
2019
*/
2120

2221
namespace App\Auth\Abilities;
2322

2423
use App\MasterData\User;
2524

26-
class ActivityLogAbilities {
27-
28-
public function view(User $user) {
29-
return $user->isAdmin();
30-
}
31-
25+
class ActivityLogAbilities
26+
{
27+
public function view(User $user)
28+
{
29+
return $user->isAdmin();
30+
}
3231
}

Diff for: app/Auth/Abilities/ApplicantAbilities.php

+35-31
Original file line numberDiff line numberDiff line change
@@ -16,42 +16,46 @@
1616
*
1717
* You should have received a copy of the GNU Affero General Public License,version 3,
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>
19-
*
2019
*/
2120

2221
namespace App\Auth\Abilities;
2322

2423
use App\MasterData\Applicant;
2524
use App\MasterData\User;
2625

27-
class ApplicantAbilities {
28-
29-
use CommonAbilities;
30-
31-
private function administrates(User $user, Applicant $applicant) {
32-
if ($applicant->wuser_username === $user->username) {
33-
return true;
34-
}
35-
if (!is_null($applicant->association) && $applicant->association->wuser_username === $user->username) {
36-
return true;
37-
}
38-
return false;
39-
}
40-
41-
public function show(User $user, Applicant $applicant) {
42-
return $this->administrates($user, $applicant);
43-
}
44-
45-
public function create(User $user) {
46-
return $user->associations()->exists();
47-
}
48-
49-
public function import(User $user) {
50-
return false;
51-
}
52-
53-
public function edit(User $user, Applicant $applicant) {
54-
return $this->administrates($user, $applicant);
55-
}
56-
26+
class ApplicantAbilities
27+
{
28+
use CommonAbilities;
29+
30+
private function administrates(User $user, Applicant $applicant)
31+
{
32+
if ($applicant->wuser_username === $user->username) {
33+
return true;
34+
}
35+
if (! is_null($applicant->association) && $applicant->association->wuser_username === $user->username) {
36+
return true;
37+
}
38+
39+
return false;
40+
}
41+
42+
public function show(User $user, Applicant $applicant)
43+
{
44+
return $this->administrates($user, $applicant);
45+
}
46+
47+
public function create(User $user)
48+
{
49+
return $user->associations()->exists();
50+
}
51+
52+
public function import(User $user)
53+
{
54+
return false;
55+
}
56+
57+
public function edit(User $user, Applicant $applicant)
58+
{
59+
return $this->administrates($user, $applicant);
60+
}
5761
}

Diff for: app/Auth/Abilities/AssociationAbilities.php

+23-21
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,34 @@
1616
*
1717
* You should have received a copy of the GNU Affero General Public License,version 3,
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>
19-
*
2019
*/
2120

2221
namespace App\Auth\Abilities;
2322

2423
use App\MasterData\Association;
2524
use App\MasterData\User;
2625

27-
class AssociationAbilities {
28-
29-
use CommonAbilities;
30-
31-
private function administrates(User $user, Association $association) {
32-
return $association->user && $association->user->username === $user->username;
33-
}
34-
35-
public function show(User $user, Association $association) {
36-
return $this->administrates($user, $association);
37-
}
38-
39-
public function create(User $user) {
40-
return false;
41-
}
42-
43-
public function edit(User $user, Association $association) {
44-
return $this->administrates($user, $association);
45-
}
46-
26+
class AssociationAbilities
27+
{
28+
use CommonAbilities;
29+
30+
private function administrates(User $user, Association $association)
31+
{
32+
return $association->user && $association->user->username === $user->username;
33+
}
34+
35+
public function show(User $user, Association $association)
36+
{
37+
return $this->administrates($user, $association);
38+
}
39+
40+
public function create(User $user)
41+
{
42+
return false;
43+
}
44+
45+
public function edit(User $user, Association $association)
46+
{
47+
return $this->administrates($user, $association);
48+
}
4749
}

0 commit comments

Comments
 (0)