Skip to content

Commit d3ff07d

Browse files
CS fixes
1 parent b029a1b commit d3ff07d

23 files changed

+109
-93
lines changed

src/Illuminate/Auth/EloquentUserProvider.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ public function retrieveByToken($identifier, $token)
7474

7575
$rememberToken = $retrievedModel->getRememberToken();
7676

77-
return $rememberToken && hash_equals($rememberToken, $token)
78-
? $retrievedModel : null;
77+
return $rememberToken && hash_equals($rememberToken, $token) ? $retrievedModel : null;
7978
}
8079

8180
/**

src/Illuminate/Database/Eloquent/Builder.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1706,8 +1706,8 @@ public static function __callStatic($method, $parameters)
17061706
protected static function registerMixin($mixin, $replace)
17071707
{
17081708
$methods = (new ReflectionClass($mixin))->getMethods(
1709-
ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED
1710-
);
1709+
ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED
1710+
);
17111711

17121712
foreach ($methods as $method) {
17131713
if ($replace || ! static::hasGlobalMacro($method->name)) {

src/Illuminate/Foundation/Auth/EmailVerificationRequest.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@ class EmailVerificationRequest extends FormRequest
1414
*/
1515
public function authorize()
1616
{
17-
if (! hash_equals((string) $this->user()->getKey(),
18-
(string) $this->route('id'))) {
17+
if (! hash_equals((string) $this->user()->getKey(), (string) $this->route('id'))) {
1918
return false;
2019
}
2120

22-
if (! hash_equals(sha1($this->user()->getEmailForVerification()),
23-
(string) $this->route('hash'))) {
21+
if (! hash_equals(sha1($this->user()->getEmailForVerification()), (string) $this->route('hash'))) {
2422
return false;
2523
}
2624

src/Illuminate/Foundation/Console/ServeCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ protected function serverCommand()
141141
*/
142142
protected function host()
143143
{
144-
[$host, ] = $this->getHostAndPort();
144+
[$host] = $this->getHostAndPort();
145145

146146
return $host;
147147
}

src/Illuminate/Queue/Console/ClearCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function handle()
4646
// connection being run for the queue operation currently being executed.
4747
$queueName = $this->getQueue($connection);
4848

49-
$queue = ($this->laravel['queue'])->connection($connection);
49+
$queue = $this->laravel['queue']->connection($connection);
5050

5151
if ($queue instanceof ClearableQueue) {
5252
$count = $queue->clear($queueName);

src/Illuminate/Queue/Console/WorkCommand.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,12 @@ public function handle()
111111
*/
112112
protected function runWorker($connection, $queue)
113113
{
114-
return $this->worker->setName($this->option('name'))
115-
->setCache($this->cache)
116-
->{$this->option('once') ? 'runNextJob' : 'daemon'}(
117-
$connection, $queue, $this->gatherWorkerOptions()
118-
);
114+
return $this->worker
115+
->setName($this->option('name'))
116+
->setCache($this->cache)
117+
->{$this->option('once') ? 'runNextJob' : 'daemon'}(
118+
$connection, $queue, $this->gatherWorkerOptions()
119+
);
119120
}
120121

121122
/**

src/Illuminate/Redis/Connectors/PhpRedisConnector.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ protected function establishConnection($client, array $config)
150150
}
151151
}
152152

153-
$client->{($persistent ? 'pconnect' : 'connect')}(...$parameters);
153+
$client->{$persistent ? 'pconnect' : 'connect'}(...$parameters);
154154
}
155155

156156
/**

src/Illuminate/Support/Facades/Cache.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @method static \Illuminate\Cache\TaggedCache tags(array|mixed $names)
77
* @method static \Illuminate\Contracts\Cache\Lock lock(string $name, int $seconds = 0, mixed $owner = null)
88
* @method static \Illuminate\Contracts\Cache\Lock restoreLock(string $name, string $owner)
9-
* @method static \Illuminate\Contracts\Cache\Repository store(string|null $name = null)
9+
* @method static \Illuminate\Contracts\Cache\Repository store(string|null $name = null)
1010
* @method static \Illuminate\Contracts\Cache\Store getStore()
1111
* @method static bool add(string $key, $value, \DateTimeInterface|\DateInterval|int $ttl = null)
1212
* @method static bool flush()

src/Illuminate/Testing/PendingCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ protected function verifyExpectations()
324324
protected function mockConsoleOutput()
325325
{
326326
$mock = Mockery::mock(OutputStyle::class.'[askQuestion]', [
327-
(new ArrayInput($this->parameters)), $this->createABufferedOutputMock(),
327+
new ArrayInput($this->parameters), $this->createABufferedOutputMock(),
328328
]);
329329

330330
foreach ($this->test->expectedQuestions as $i => $question) {

src/Illuminate/Testing/TestComponent.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function assertSee($value, $escape = true)
6161
*/
6262
public function assertSeeInOrder(array $values, $escape = true)
6363
{
64-
$values = $escape ? array_map('e', ($values)) : $values;
64+
$values = $escape ? array_map('e', $values) : $values;
6565

6666
PHPUnit::assertThat($values, new SeeInOrder($this->rendered));
6767

@@ -93,7 +93,7 @@ public function assertSeeText($value, $escape = true)
9393
*/
9494
public function assertSeeTextInOrder(array $values, $escape = true)
9595
{
96-
$values = $escape ? array_map('e', ($values)) : $values;
96+
$values = $escape ? array_map('e', $values) : $values;
9797

9898
PHPUnit::assertThat($values, new SeeInOrder(strip_tags($this->rendered)));
9999

src/Illuminate/Testing/TestResponse.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ public function assertSee($value, $escape = true)
575575
{
576576
$value = Arr::wrap($value);
577577

578-
$values = $escape ? array_map('e', ($value)) : $value;
578+
$values = $escape ? array_map('e', $value) : $value;
579579

580580
foreach ($values as $value) {
581581
PHPUnit::assertStringContainsString((string) $value, $this->getContent());
@@ -593,7 +593,7 @@ public function assertSee($value, $escape = true)
593593
*/
594594
public function assertSeeInOrder(array $values, $escape = true)
595595
{
596-
$values = $escape ? array_map('e', ($values)) : $values;
596+
$values = $escape ? array_map('e', $values) : $values;
597597

598598
PHPUnit::assertThat($values, new SeeInOrder($this->getContent()));
599599

@@ -611,7 +611,7 @@ public function assertSeeText($value, $escape = true)
611611
{
612612
$value = Arr::wrap($value);
613613

614-
$values = $escape ? array_map('e', ($value)) : $value;
614+
$values = $escape ? array_map('e', $value) : $value;
615615

616616
tap(strip_tags($this->getContent()), function ($content) use ($values) {
617617
foreach ($values as $value) {
@@ -631,7 +631,7 @@ public function assertSeeText($value, $escape = true)
631631
*/
632632
public function assertSeeTextInOrder(array $values, $escape = true)
633633
{
634-
$values = $escape ? array_map('e', ($values)) : $values;
634+
$values = $escape ? array_map('e', $values) : $values;
635635

636636
PHPUnit::assertThat($values, new SeeInOrder(strip_tags($this->getContent())));
637637

@@ -649,7 +649,7 @@ public function assertDontSee($value, $escape = true)
649649
{
650650
$value = Arr::wrap($value);
651651

652-
$values = $escape ? array_map('e', ($value)) : $value;
652+
$values = $escape ? array_map('e', $value) : $value;
653653

654654
foreach ($values as $value) {
655655
PHPUnit::assertStringNotContainsString((string) $value, $this->getContent());
@@ -669,7 +669,7 @@ public function assertDontSeeText($value, $escape = true)
669669
{
670670
$value = Arr::wrap($value);
671671

672-
$values = $escape ? array_map('e', ($value)) : $value;
672+
$values = $escape ? array_map('e', $value) : $value;
673673

674674
tap(strip_tags($this->getContent()), function ($content) use ($values) {
675675
foreach ($values as $value) {

src/Illuminate/Testing/TestView.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function assertSee($value, $escape = true)
6262
*/
6363
public function assertSeeInOrder(array $values, $escape = true)
6464
{
65-
$values = $escape ? array_map('e', ($values)) : $values;
65+
$values = $escape ? array_map('e', $values) : $values;
6666

6767
PHPUnit::assertThat($values, new SeeInOrder($this->rendered));
6868

@@ -94,7 +94,7 @@ public function assertSeeText($value, $escape = true)
9494
*/
9595
public function assertSeeTextInOrder(array $values, $escape = true)
9696
{
97-
$values = $escape ? array_map('e', ($values)) : $values;
97+
$values = $escape ? array_map('e', $values) : $values;
9898

9999
PHPUnit::assertThat($values, new SeeInOrder(strip_tags($this->rendered)));
100100

src/Illuminate/Validation/Concerns/ValidatesAttributes.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ protected function checkDateTimeOrder($format, $first, $second, $operator)
272272
$secondDate = $this->getDateTimeWithOptionalFormat($format, $second);
273273
}
274274

275-
return ($firstDate && $secondDate) && ($this->compare($firstDate, $secondDate, $operator));
275+
return ($firstDate && $secondDate) && $this->compare($firstDate, $secondDate, $operator);
276276
}
277277

278278
/**

tests/Integration/Cookie/CookieTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function test_cookie_is_sent_back_with_proper_expire_time_when_should_exp
2424

2525
$response = $this->get('/');
2626
$this->assertCount(2, $response->headers->getCookies());
27-
$this->assertEquals(0, ($response->headers->getCookies()[1])->getExpiresTime());
27+
$this->assertEquals(0, $response->headers->getCookies()[1]->getExpiresTime());
2828
}
2929

3030
public function test_cookie_is_sent_back_with_proper_expire_time_with_respect_to_lifetime()
@@ -39,7 +39,7 @@ public function test_cookie_is_sent_back_with_proper_expire_time_with_respect_to
3939
Carbon::setTestNow(Carbon::now());
4040
$response = $this->get('/');
4141
$this->assertCount(2, $response->headers->getCookies());
42-
$this->assertEquals(Carbon::now()->getTimestamp() + 60, ($response->headers->getCookies()[1])->getExpiresTime());
42+
$this->assertEquals(Carbon::now()->getTimestamp() + 60, $response->headers->getCookies()[1]->getExpiresTime());
4343
}
4444

4545
protected function getEnvironmentSetUp($app)

tests/Integration/Events/QueuedClosureListenerTest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Illuminate\Events\CallQueuedListener;
66
use Illuminate\Events\InvokeQueuedClosure;
7-
use function Illuminate\Events\queueable;
87
use Illuminate\Support\Facades\Bus;
98
use Illuminate\Support\Facades\Event;
109
use Orchestra\Testbench\TestCase;
@@ -15,7 +14,7 @@ public function testAnonymousQueuedListenerIsQueued()
1514
{
1615
Bus::fake();
1716

18-
Event::listen(queueable(function (TestEvent $event) {
17+
Event::listen(\Illuminate\Events\queueable(function (TestEvent $event) {
1918
//
2019
})->catch(function (TestEvent $event) {
2120
//

tests/Integration/Http/ResourceTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,7 @@ public function work()
13211321
'Mohamed',
13221322
$this->mergeWhen(false, ['Adam', 'Matt']),
13231323
'Jeffrey',
1324-
$this->mergeWhen(false, (['Abigail', 'Lydia'])),
1324+
$this->mergeWhen(false, ['Abigail', 'Lydia']),
13251325
]);
13261326
}
13271327
};

tests/Pagination/LengthAwarePaginatorTest.php

+39-21
Original file line numberDiff line numberDiff line change
@@ -74,50 +74,68 @@ public function testLengthAwarePaginatorCanGenerateUrls()
7474
$this->p->setPath('http://website.com');
7575
$this->p->setPageName('foo');
7676

77-
$this->assertSame('http://website.com',
78-
$this->p->path());
79-
80-
$this->assertSame('http://website.com?foo=2',
81-
$this->p->url($this->p->currentPage()));
82-
83-
$this->assertSame('http://website.com?foo=1',
84-
$this->p->url($this->p->currentPage() - 1));
85-
86-
$this->assertSame('http://website.com?foo=1',
87-
$this->p->url($this->p->currentPage() - 2));
77+
$this->assertSame(
78+
'http://website.com',
79+
$this->p->path()
80+
);
81+
82+
$this->assertSame(
83+
'http://website.com?foo=2',
84+
$this->p->url($this->p->currentPage())
85+
);
86+
87+
$this->assertSame(
88+
'http://website.com?foo=1',
89+
$this->p->url($this->p->currentPage() - 1)
90+
);
91+
92+
$this->assertSame(
93+
'http://website.com?foo=1',
94+
$this->p->url($this->p->currentPage() - 2)
95+
);
8896
}
8997

9098
public function testLengthAwarePaginatorCanGenerateUrlsWithQuery()
9199
{
92100
$this->p->setPath('http://website.com?sort_by=date');
93101
$this->p->setPageName('foo');
94102

95-
$this->assertSame('http://website.com?sort_by=date&foo=2',
96-
$this->p->url($this->p->currentPage()));
103+
$this->assertSame(
104+
'http://website.com?sort_by=date&foo=2',
105+
$this->p->url($this->p->currentPage())
106+
);
97107
}
98108

99109
public function testLengthAwarePaginatorCanGenerateUrlsWithoutTrailingSlashes()
100110
{
101111
$this->p->setPath('http://website.com/test');
102112
$this->p->setPageName('foo');
103113

104-
$this->assertSame('http://website.com/test?foo=2',
105-
$this->p->url($this->p->currentPage()));
114+
$this->assertSame(
115+
'http://website.com/test?foo=2',
116+
$this->p->url($this->p->currentPage())
117+
);
106118

107-
$this->assertSame('http://website.com/test?foo=1',
108-
$this->p->url($this->p->currentPage() - 1));
119+
$this->assertSame(
120+
'http://website.com/test?foo=1',
121+
$this->p->url($this->p->currentPage() - 1)
122+
);
109123

110-
$this->assertSame('http://website.com/test?foo=1',
111-
$this->p->url($this->p->currentPage() - 2));
124+
$this->assertSame(
125+
'http://website.com/test?foo=1',
126+
$this->p->url($this->p->currentPage() - 2)
127+
);
112128
}
113129

114130
public function testLengthAwarePaginatorCorrectlyGenerateUrlsWithQueryAndSpaces()
115131
{
116132
$this->p->setPath('http://website.com?key=value%20with%20spaces');
117133
$this->p->setPageName('foo');
118134

119-
$this->assertSame('http://website.com?key=value%20with%20spaces&foo=2',
120-
$this->p->url($this->p->currentPage()));
135+
$this->assertSame(
136+
'http://website.com?key=value%20with%20spaces&foo=2',
137+
$this->p->url($this->p->currentPage())
138+
);
121139
}
122140

123141
public function testItRetrievesThePaginatorOptions()

tests/Pagination/PaginatorTest.php

+8-13
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class PaginatorTest extends TestCase
99
{
1010
public function testSimplePaginatorReturnsRelevantContextInformation()
1111
{
12-
$p = new Paginator($array = ['item3', 'item4', 'item5'], 2, 2);
12+
$p = new Paginator(['item3', 'item4', 'item5'], 2, 2);
1313

1414
$this->assertEquals(2, $p->currentPage());
1515
$this->assertTrue($p->hasPages());
@@ -33,40 +33,35 @@ public function testSimplePaginatorReturnsRelevantContextInformation()
3333

3434
public function testPaginatorRemovesTrailingSlashes()
3535
{
36-
$p = new Paginator($array = ['item1', 'item2', 'item3'], 2, 2,
37-
['path' => 'http://website.com/test/']);
36+
$p = new Paginator(['item1', 'item2', 'item3'], 2, 2, ['path' => 'http://website.com/test/']);
3837

3938
$this->assertSame('http://website.com/test?page=1', $p->previousPageUrl());
4039
}
4140

4241
public function testPaginatorGeneratesUrlsWithoutTrailingSlash()
4342
{
44-
$p = new Paginator($array = ['item1', 'item2', 'item3'], 2, 2,
45-
['path' => 'http://website.com/test']);
43+
$p = new Paginator(['item1', 'item2', 'item3'], 2, 2, ['path' => 'http://website.com/test']);
4644

4745
$this->assertSame('http://website.com/test?page=1', $p->previousPageUrl());
4846
}
4947

5048
public function testItRetrievesThePaginatorOptions()
5149
{
52-
$p = new Paginator($array = ['item1', 'item2', 'item3'], 2, 2,
53-
$options = ['path' => 'http://website.com/test']);
50+
$p = new Paginator(['item1', 'item2', 'item3'], 2, 2, ['path' => 'http://website.com/test']);
5451

55-
$this->assertSame($p->getOptions(), $options);
52+
$this->assertSame(['path' => 'http://website.com/test'], $p->getOptions());
5653
}
5754

5855
public function testPaginatorReturnsPath()
5956
{
60-
$p = new Paginator($array = ['item1', 'item2', 'item3'], 2, 2,
61-
['path' => 'http://website.com/test']);
57+
$p = new Paginator(['item1', 'item2', 'item3'], 2, 2, ['path' => 'http://website.com/test']);
6258

63-
$this->assertSame($p->path(), 'http://website.com/test');
59+
$this->assertSame('http://website.com/test', $p->path());
6460
}
6561

6662
public function testCanTransformPaginatorItems()
6763
{
68-
$p = new Paginator($array = ['item1', 'item2', 'item3'], 3, 1,
69-
['path' => 'http://website.com/test']);
64+
$p = new Paginator(['item1', 'item2', 'item3'], 3, 1, ['path' => 'http://website.com/test']);
7065

7166
$p->through(function ($item) {
7267
return substr($item, 4, 1);

0 commit comments

Comments
 (0)