Skip to content

Commit f69ad90

Browse files
committed
formatting
1 parent 56b11d4 commit f69ad90

File tree

7 files changed

+22
-22
lines changed

7 files changed

+22
-22
lines changed

Diff for: src/Illuminate/Support/Testing/Fakes/BusFake.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function __construct(QueueingDispatcher $dispatcher, $jobsToFake = [])
6464
public function assertDispatched($command, $callback = null)
6565
{
6666
if ($command instanceof Closure) {
67-
[$command, $callback] = [$this->firstParameterType($command), $command];
67+
[$command, $callback] = [$this->firstClosureParameterType($command), $command];
6868
}
6969

7070
if (is_numeric($callback)) {
@@ -106,7 +106,7 @@ public function assertDispatchedTimes($command, $times = 1)
106106
public function assertNotDispatched($command, $callback = null)
107107
{
108108
if ($command instanceof Closure) {
109-
[$command, $callback] = [$this->firstParameterType($command), $command];
109+
[$command, $callback] = [$this->firstClosureParameterType($command), $command];
110110
}
111111

112112
PHPUnit::assertTrue(
@@ -126,7 +126,7 @@ public function assertNotDispatched($command, $callback = null)
126126
public function assertDispatchedAfterResponse($command, $callback = null)
127127
{
128128
if ($command instanceof Closure) {
129-
[$command, $callback] = [$this->firstParameterType($command), $command];
129+
[$command, $callback] = [$this->firstClosureParameterType($command), $command];
130130
}
131131

132132
if (is_numeric($callback)) {
@@ -166,7 +166,7 @@ public function assertDispatchedAfterResponseTimes($command, $times = 1)
166166
public function assertNotDispatchedAfterResponse($command, $callback = null)
167167
{
168168
if ($command instanceof Closure) {
169-
[$command, $callback] = [$this->firstParameterType($command), $command];
169+
[$command, $callback] = [$this->firstClosureParameterType($command), $command];
170170
}
171171

172172
PHPUnit::assertCount(

Diff for: src/Illuminate/Support/Testing/Fakes/EventFake.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function __construct(Dispatcher $dispatcher, $eventsToFake = [])
5757
public function assertDispatched($event, $callback = null)
5858
{
5959
if ($event instanceof Closure) {
60-
[$event, $callback] = [$this->firstParameterType($event), $event];
60+
[$event, $callback] = [$this->firstClosureParameterType($event), $event];
6161
}
6262

6363
if (is_int($callback)) {
@@ -97,7 +97,7 @@ public function assertDispatchedTimes($event, $times = 1)
9797
public function assertNotDispatched($event, $callback = null)
9898
{
9999
if ($event instanceof Closure) {
100-
[$event, $callback] = [$this->firstParameterType($event), $event];
100+
[$event, $callback] = [$this->firstClosureParameterType($event), $event];
101101
}
102102

103103
PHPUnit::assertCount(

Diff for: src/Illuminate/Support/Testing/Fakes/MailFake.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class MailFake implements Factory, Mailer, MailQueue
4646
public function assertSent($mailable, $callback = null)
4747
{
4848
if ($mailable instanceof Closure) {
49-
[$mailable, $callback] = [$this->firstParameterType($mailable), $mailable];
49+
[$mailable, $callback] = [$this->firstClosureParameterType($mailable), $mailable];
5050
}
5151

5252
if (is_numeric($callback)) {
@@ -121,7 +121,7 @@ public function assertNothingSent()
121121
public function assertQueued($mailable, $callback = null)
122122
{
123123
if ($mailable instanceof Closure) {
124-
[$mailable, $callback] = [$this->firstParameterType($mailable), $mailable];
124+
[$mailable, $callback] = [$this->firstClosureParameterType($mailable), $mailable];
125125
}
126126

127127
if (is_numeric($callback)) {

Diff for: src/Illuminate/Support/Testing/Fakes/NotificationFake.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function assertSentTo($notifiable, $notification, $callback = null)
5656
}
5757

5858
if ($notification instanceof Closure) {
59-
[$notification, $callback] = [$this->firstParameterType($notification), $notification];
59+
[$notification, $callback] = [$this->firstClosureParameterType($notification), $notification];
6060
}
6161

6262
if (is_numeric($callback)) {
@@ -112,7 +112,7 @@ public function assertNotSentTo($notifiable, $notification, $callback = null)
112112
}
113113

114114
if ($notification instanceof Closure) {
115-
[$notification, $callback] = [$this->firstParameterType($notification), $notification];
115+
[$notification, $callback] = [$this->firstClosureParameterType($notification), $notification];
116116
}
117117

118118
PHPUnit::assertCount(

Diff for: src/Illuminate/Support/Testing/Fakes/QueueFake.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class QueueFake extends QueueManager implements Queue
3030
public function assertPushed($job, $callback = null)
3131
{
3232
if ($job instanceof Closure) {
33-
[$job, $callback] = [$this->firstParameterType($job), $job];
33+
[$job, $callback] = [$this->firstClosureParameterType($job), $job];
3434
}
3535

3636
if (is_numeric($callback)) {
@@ -71,7 +71,7 @@ protected function assertPushedTimes($job, $times = 1)
7171
public function assertPushedOn($queue, $job, $callback = null)
7272
{
7373
if ($job instanceof Closure) {
74-
[$job, $callback] = [$this->firstParameterType($job), $job];
74+
[$job, $callback] = [$this->firstClosureParameterType($job), $job];
7575
}
7676

7777
return $this->assertPushed($job, function ($job, $pushedQueue) use ($callback, $queue) {
@@ -193,7 +193,7 @@ protected function isChainOfObjects($chain)
193193
public function assertNotPushed($job, $callback = null)
194194
{
195195
if ($job instanceof Closure) {
196-
[$job, $callback] = [$this->firstParameterType($job), $job];
196+
[$job, $callback] = [$this->firstClosureParameterType($job), $job];
197197
}
198198

199199
PHPUnit::assertCount(

Diff for: src/Illuminate/Support/Traits/ReflectsClosures.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
trait ReflectsClosures
1111
{
1212
/**
13-
* Get the class types of the parameters of the given closure.
13+
* Get the class names / types of the parameters of the given Closure.
1414
*
1515
* @param Closure $closure
1616
* @return array
1717
*
1818
* @throws \ReflectionException
1919
*/
20-
protected function parameterTypes(Closure $closure)
20+
protected function closureParameterTypes(Closure $closure)
2121
{
2222
$reflection = new ReflectionFunction($closure);
2323

@@ -31,23 +31,23 @@ protected function parameterTypes(Closure $closure)
3131
}
3232

3333
/**
34-
* Get the class of the first parameter of the given closure.
34+
* Get the class name of the first parameter of the given Closure.
3535
*
3636
* @param Closure $closure
3737
* @return string
3838
*
3939
* @throws \ReflectionException|\RunTimeException
4040
*/
41-
protected function firstParameterType(Closure $closure)
41+
protected function firstClosureParameterType(Closure $closure)
4242
{
43-
$types = $this->parameterTypes($closure);
43+
$types = $this->closureParameterTypes($closure);
4444

4545
if (! $types) {
46-
throw new RunTimeException('The given closure has no parameters');
46+
throw new RunTimeException('The given Closure has no parameters.');
4747
}
4848

4949
if ($types[0] === null) {
50-
throw new RunTimeException('The first parameter of the given closure has no class type hint');
50+
throw new RunTimeException('The first parameter of the given Closure is missing a type hint.');
5151
}
5252

5353
return $types[0];

Diff for: tests/Support/SupportReflectsClosuresTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ class ReflectsClosuresClass
7878

7979
public static function reflect($closure)
8080
{
81-
return (new static)->parameterTypes($closure);
81+
return (new static)->closureParameterTypes($closure);
8282
}
8383

8484
public static function reflectFirst($closure)
8585
{
86-
return (new static)->firstParameterType($closure);
86+
return (new static)->firstClosureParameterType($closure);
8787
}
8888
}
8989

0 commit comments

Comments
 (0)