Skip to content

Commit 6722667

Browse files
CS fixes
1 parent 01e8450 commit 6722667

File tree

149 files changed

+677
-673
lines changed

Some content is hidden

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

149 files changed

+677
-673
lines changed

.php_cs

+28-16
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,43 @@
11
<?php
22

3-
$finder = Symfony\Component\Finder\Finder::create()
4-
->files()
5-
->in(__DIR__)
6-
->name('*.stub')
7-
->ignoreDotFiles(true)
8-
->ignoreVCS(true);
3+
use Symfony\CS\Config\Config;
4+
use Symfony\CS\FixerInterface;
5+
use Symfony\CS\Finder\DefaultFinder;
96

107
$fixers = [
11-
'-psr0',
12-
'-php_closing_tag',
138
'blankline_after_open_tag',
9+
'braces',
1410
'concat_without_spaces',
1511
'double_arrow_multiline_whitespaces',
1612
'duplicate_semicolon',
13+
'elseif',
1714
'empty_return',
15+
'encoding',
16+
'eof_ending',
1817
'extra_empty_lines',
18+
'function_call_space',
19+
'function_declaration',
1920
'include',
21+
'indentation',
22+
'linefeed',
2023
'join_function',
24+
'line_after_namespace',
2125
'list_commas',
26+
'logical_not_operators_with_successor_space',
27+
'lowercase_constants',
28+
'lowercase_keywords',
29+
'method_argument_space',
2230
'multiline_array_trailing_comma',
31+
'multiline_spaces_before_semicolon',
32+
'multiple_use',
2333
'namespace_no_leading_whitespace',
2434
'no_blank_lines_after_class_opening',
2535
'no_empty_lines_after_phpdocs',
2636
'object_operator',
2737
'operators_spaces',
38+
'parenthesis',
2839
'phpdoc_indent',
40+
'phpdoc_inline_tag',
2941
'phpdoc_no_access',
3042
'phpdoc_no_package',
3143
'phpdoc_scalar',
@@ -38,24 +50,24 @@ $fixers = [
3850
'remove_lines_between_uses',
3951
'return',
4052
'self_accessor',
53+
'short_array_syntax',
54+
'short_echo_tag',
55+
'short_tag',
4156
'single_array_no_trailing_comma',
4257
'single_blank_line_before_namespace',
58+
'single_line_after_imports',
4359
'single_quote',
4460
'spaces_before_semicolon',
4561
'spaces_cast',
4662
'standardize_not_equal',
4763
'ternary_spaces',
64+
'trailing_spaces',
4865
'trim_array_spaces',
4966
'unalign_equals',
5067
'unary_operators_spaces',
68+
'unused_use',
69+
'visibility',
5170
'whitespacy_lines',
52-
'multiline_spaces_before_semicolon',
53-
'short_array_syntax',
54-
'short_echo_tag',
5571
];
5672

57-
return Symfony\CS\Config\Config::create()
58-
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
59-
->fixers($fixers)
60-
->finder($finder)
61-
->setUsingCache(true);
73+
return Config::create()->level(FixerInterface::NONE_LEVEL)->fixers($fixers)->finder(DefaultFinder::create()->in(__DIR__));

.styleci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
preset: laravel

src/Illuminate/Auth/AuthManager.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ protected function createDriver($driver)
2929
}
3030

3131
if (method_exists($guard, 'setRequest')) {
32-
$guard->setRequest($this->app->refresh('request', $guard, 'setRequest'));
32+
$guard->setRequest($this->app->refresh('request', $guard, 'setRequest'));
3333
}
34-
34+
3535
return $guard;
3636
}
3737

src/Illuminate/Auth/DatabaseUserProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function retrieveByCredentials(array $credentials)
104104
$query = $this->conn->table($this->table);
105105

106106
foreach ($credentials as $key => $value) {
107-
if (!Str::contains($key, 'password')) {
107+
if (! Str::contains($key, 'password')) {
108108
$query->where($key, $value);
109109
}
110110
}

src/Illuminate/Auth/EloquentUserProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function retrieveByCredentials(array $credentials)
9292
$query = $this->createModel()->newQuery();
9393

9494
foreach ($credentials as $key => $value) {
95-
if (!Str::contains($key, 'password')) {
95+
if (! Str::contains($key, 'password')) {
9696
$query->where($key, $value);
9797
}
9898
}

src/Illuminate/Auth/Guard.php

+14-14
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function __construct(UserProvider $provider,
109109
*/
110110
public function check()
111111
{
112-
return !is_null($this->user());
112+
return ! is_null($this->user());
113113
}
114114

115115
/**
@@ -119,7 +119,7 @@ public function check()
119119
*/
120120
public function guest()
121121
{
122-
return !$this->check();
122+
return ! $this->check();
123123
}
124124

125125
/**
@@ -136,7 +136,7 @@ public function user()
136136
// If we have already retrieved the user for the current request we can just
137137
// return it back immediately. We do not want to pull the user data every
138138
// request into the method because that would tremendously slow an app.
139-
if (!is_null($this->user)) {
139+
if (! is_null($this->user)) {
140140
return $this->user;
141141
}
142142

@@ -147,7 +147,7 @@ public function user()
147147
// request, and if one exists, attempt to retrieve the user using that.
148148
$user = null;
149149

150-
if (!is_null($id)) {
150+
if (! is_null($id)) {
151151
$user = $this->provider->retrieveById($id);
152152
}
153153

@@ -156,7 +156,7 @@ public function user()
156156
// the application. Once we have a user we can return it to the caller.
157157
$recaller = $this->getRecaller();
158158

159-
if (is_null($user) && !is_null($recaller)) {
159+
if (is_null($user) && ! is_null($recaller)) {
160160
$user = $this->getUserByRecaller($recaller);
161161

162162
if ($user) {
@@ -197,12 +197,12 @@ public function id()
197197
*/
198198
protected function getUserByRecaller($recaller)
199199
{
200-
if ($this->validRecaller($recaller) && !$this->tokenRetrievalAttempted) {
200+
if ($this->validRecaller($recaller) && ! $this->tokenRetrievalAttempted) {
201201
$this->tokenRetrievalAttempted = true;
202202

203203
list($id, $token) = explode('|', $recaller, 2);
204204

205-
$this->viaRemember = !is_null($user = $this->provider->retrieveByToken($id, $token));
205+
$this->viaRemember = ! is_null($user = $this->provider->retrieveByToken($id, $token));
206206

207207
return $user;
208208
}
@@ -238,7 +238,7 @@ protected function getRecallerId()
238238
*/
239239
protected function validRecaller($recaller)
240240
{
241-
if (!is_string($recaller) || !Str::contains($recaller, '|')) {
241+
if (! is_string($recaller) || ! Str::contains($recaller, '|')) {
242242
return false;
243243
}
244244

@@ -305,7 +305,7 @@ public function basic($field = 'email')
305305
*/
306306
public function onceBasic($field = 'email')
307307
{
308-
if (!$this->once($this->getBasicCredentials($this->getRequest(), $field))) {
308+
if (! $this->once($this->getBasicCredentials($this->getRequest(), $field))) {
309309
return $this->getBasicResponse();
310310
}
311311
}
@@ -319,7 +319,7 @@ public function onceBasic($field = 'email')
319319
*/
320320
protected function attemptBasic(Request $request, $field)
321321
{
322-
if (!$request->getUser()) {
322+
if (! $request->getUser()) {
323323
return false;
324324
}
325325

@@ -387,7 +387,7 @@ public function attempt(array $credentials = [], $remember = false, $login = tru
387387
*/
388388
protected function hasValidCredentials($user, $credentials)
389389
{
390-
return !is_null($user) && $this->provider->validateCredentials($user, $credentials);
390+
return ! is_null($user) && $this->provider->validateCredentials($user, $credentials);
391391
}
392392

393393
/**
@@ -499,7 +499,7 @@ public function loginUsingId($id, $remember = false)
499499
*/
500500
public function onceUsingId($id)
501501
{
502-
if (!is_null($user = $this->provider->retrieveById($id))) {
502+
if (! is_null($user = $this->provider->retrieveById($id))) {
503503
$this->setUser($user);
504504

505505
return true;
@@ -546,7 +546,7 @@ public function logout()
546546
// listening for anytime a user signs out of this application manually.
547547
$this->clearUserDataFromStorage();
548548

549-
if (!is_null($this->user)) {
549+
if (! is_null($this->user)) {
550550
$this->refreshRememberToken($user);
551551
}
552552

@@ -611,7 +611,7 @@ protected function createRememberTokenIfDoesntExist(UserContract $user)
611611
*/
612612
public function getCookieJar()
613613
{
614-
if (!isset($this->cookie)) {
614+
if (! isset($this->cookie)) {
615615
throw new RuntimeException('Cookie jar has not been set.');
616616
}
617617

src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function exists(CanResetPasswordContract $user, $token)
112112

113113
$token = (array) $this->getTable()->where('email', $email)->where('token', $token)->first();
114114

115-
return $token && !$this->tokenExpired($token);
115+
return $token && ! $this->tokenExpired($token);
116116
}
117117

118118
/**

src/Illuminate/Auth/Passwords/PasswordBroker.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function emailResetLink(CanResetPasswordContract $user, $token, Closure $
112112
return $this->mailer->send($view, compact('token', 'user'), function ($m) use ($user, $token, $callback) {
113113
$m->to($user->getEmailForPasswordReset());
114114

115-
if (!is_null($callback)) {
115+
if (! is_null($callback)) {
116116
call_user_func($callback, $m, $user, $token);
117117
}
118118
});
@@ -132,7 +132,7 @@ public function reset(array $credentials, Closure $callback)
132132
// the user is properly redirected having an error message on the post.
133133
$user = $this->validateReset($credentials);
134134

135-
if (!$user instanceof CanResetPasswordContract) {
135+
if (! $user instanceof CanResetPasswordContract) {
136136
return $user;
137137
}
138138

@@ -160,11 +160,11 @@ protected function validateReset(array $credentials)
160160
return PasswordBrokerContract::INVALID_USER;
161161
}
162162

163-
if (!$this->validateNewPassword($credentials)) {
163+
if (! $this->validateNewPassword($credentials)) {
164164
return PasswordBrokerContract::INVALID_PASSWORD;
165165
}
166166

167-
if (!$this->tokens->exists($user, $credentials['token'])) {
167+
if (! $this->tokens->exists($user, $credentials['token'])) {
168168
return PasswordBrokerContract::INVALID_TOKEN;
169169
}
170170

@@ -233,7 +233,7 @@ public function getUser(array $credentials)
233233

234234
$user = $this->users->retrieveByCredentials($credentials);
235235

236-
if ($user && !$user instanceof CanResetPasswordContract) {
236+
if ($user && ! $user instanceof CanResetPasswordContract) {
237237
throw new UnexpectedValueException('User must implement CanResetPassword interface.');
238238
}
239239

src/Illuminate/Bus/Dispatcher.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public function dispatchToQueue($command)
235235
{
236236
$queue = call_user_func($this->queueResolver);
237237

238-
if (!$queue instanceof Queue) {
238+
if (! $queue instanceof Queue) {
239239
throw new RuntimeException('Queue resolver did not return a Queue implementation.');
240240
}
241241

src/Illuminate/Cache/DatabaseStore.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function get($key)
7070
// If we have a cache record we will check the expiration time against current
7171
// time on the system and see if the record has expired. If it has, we will
7272
// remove the records from the database table so it isn't returned again.
73-
if (!is_null($cache)) {
73+
if (! is_null($cache)) {
7474
if (is_array($cache)) {
7575
$cache = (object) $cache;
7676
}
@@ -157,7 +157,7 @@ protected function incrementOrDecrement($key, $value, Closure $callback)
157157

158158
$cache = $this->table()->where('key', $prefixed)->lockForUpdate()->first();
159159

160-
if (!is_null($cache)) {
160+
if (! is_null($cache)) {
161161
$current = $this->encrypter->decrypt($cache->value);
162162

163163
if (is_numeric($current)) {

src/Illuminate/Cache/MemcachedConnector.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function connect(array $servers)
3030

3131
$memcachedStatus = $memcached->getVersion();
3232

33-
if (!is_array($memcachedStatus)) {
33+
if (! is_array($memcachedStatus)) {
3434
throw new RuntimeException('No Memcached servers added.');
3535
}
3636

0 commit comments

Comments
 (0)