Skip to content

Commit 42b2900

Browse files
authored
Enforce consistancy when calling a function by its name. (#40788)
1 parent dccf13e commit 42b2900

File tree

13 files changed

+19
-21
lines changed

13 files changed

+19
-21
lines changed

src/Illuminate/Container/Container.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ protected function rebound($abstract)
609609
$instance = $this->make($abstract);
610610

611611
foreach ($this->getReboundCallbacks($abstract) as $callback) {
612-
call_user_func($callback, $this, $instance);
612+
$callback($this, $instance);
613613
}
614614
}
615615

src/Illuminate/Database/DatabaseTransactionRecord.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function addCallback($callback)
5757
public function executeCallbacks()
5858
{
5959
foreach ($this->callbacks as $callback) {
60-
call_user_func($callback);
60+
$callback();
6161
}
6262
}
6363

src/Illuminate/Database/DatabaseTransactionsManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function addCallback($callback)
8181
return $current->addCallback($callback);
8282
}
8383

84-
call_user_func($callback);
84+
$callback();
8585
}
8686

8787
/**

src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ protected function setAttributeMarkedMutatedAttributeValue($key, $value)
10111011
$this->attributes = array_merge(
10121012
$this->attributes,
10131013
$this->normalizeCastClassResponse(
1014-
$key, call_user_func($callback, $value, $this->attributes)
1014+
$key, $callback($value, $this->attributes)
10151015
)
10161016
);
10171017

@@ -1641,7 +1641,7 @@ protected function mergeAttributesFromAttributeCasts()
16411641
$this->attributes = array_merge(
16421642
$this->attributes,
16431643
$this->normalizeCastClassResponse(
1644-
$key, call_user_func($callback, $value, $this->attributes)
1644+
$key, $callback($value, $this->attributes)
16451645
)
16461646
);
16471647
}

src/Illuminate/Database/Query/Builder.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,7 @@ protected function addDateBasedWhere($type, $column, $operator, $value, $boolean
15151515
*/
15161516
public function whereNested(Closure $callback, $boolean = 'and')
15171517
{
1518-
call_user_func($callback, $query = $this->forNestedWhere());
1518+
$callback($query = $this->forNestedWhere());
15191519

15201520
return $this->addNestedWhereQuery($query, $boolean);
15211521
}
@@ -1566,7 +1566,7 @@ protected function whereSub($column, $operator, Closure $callback, $boolean)
15661566
// Once we have the query instance we can simply execute it so it can add all
15671567
// of the sub-select's conditions to itself, and then we can cache it off
15681568
// in the array of where clauses for the "main" parent query instance.
1569-
call_user_func($callback, $query = $this->forSubQuery());
1569+
$callback($query = $this->forSubQuery());
15701570

15711571
$this->wheres[] = compact(
15721572
'type', 'column', 'operator', 'query', 'boolean'
@@ -1592,7 +1592,7 @@ public function whereExists(Closure $callback, $boolean = 'and', $not = false)
15921592
// Similar to the sub-select clause, we will create a new query instance so
15931593
// the developer may cleanly specify the entire exists query and we will
15941594
// compile the whole thing in the grammar and insert it into the SQL.
1595-
call_user_func($callback, $query);
1595+
$callback($query);
15961596

15971597
return $this->addWhereExistsQuery($query, $boolean, $not);
15981598
}
@@ -1991,7 +1991,7 @@ public function orHaving($column, $operator = null, $value = null)
19911991
*/
19921992
public function havingNested(Closure $callback, $boolean = 'and')
19931993
{
1994-
call_user_func($callback, $query = $this->forNestedWhere());
1994+
$callback($query = $this->forNestedWhere());
19951995

19961996
return $this->addNestedHavingQuery($query, $boolean);
19971997
}
@@ -2367,7 +2367,7 @@ protected function removeExistingOrdersFor($column)
23672367
public function union($query, $all = false)
23682368
{
23692369
if ($query instanceof Closure) {
2370-
call_user_func($query, $query = $this->newQuery());
2370+
$query($query = $this->newQuery());
23712371
}
23722372

23732373
$this->unions[] = compact('query', 'all');

src/Illuminate/Queue/Middleware/RateLimited.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function handle($job, $next)
5656
return $next($job);
5757
}
5858

59-
$limiterResponse = call_user_func($limiter, $job);
59+
$limiterResponse = $limiter($job);
6060

6161
if ($limiterResponse instanceof Unlimited) {
6262
return $next($job);

src/Illuminate/Queue/Queue.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,7 @@ protected function withCreatePayloadHooks($queue, array $payload)
282282
{
283283
if (! empty(static::$createPayloadCallbacks)) {
284284
foreach (static::$createPayloadCallbacks as $callback) {
285-
$payload = array_merge($payload, call_user_func(
286-
$callback, $this->getConnectionName(), $queue, $payload
287-
));
285+
$payload = array_merge($payload, $callback($this->getConnectionName(), $queue, $payload));
288286
}
289287
}
290288

src/Illuminate/Redis/Connections/PredisConnection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function createSubscription($channels, Closure $callback, $method = 'subs
4444

4545
foreach ($loop as $message) {
4646
if ($message->kind === 'message' || $message->kind === 'pmessage') {
47-
call_user_func($callback, $message->payload, $message->channel);
47+
$callback($message->payload, $message->channel);
4848
}
4949
}
5050

src/Illuminate/Routing/Middleware/ThrottleRequests.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function handle($request, Closure $next, $maxAttempts = 60, $decayMinutes
8181
*/
8282
protected function handleRequestUsingNamedLimiter($request, Closure $next, $limiterName, Closure $limiter)
8383
{
84-
$limiterResponse = call_user_func($limiter, $request);
84+
$limiterResponse = $limiter($request);
8585

8686
if ($limiterResponse instanceof Response) {
8787
return $limiterResponse;

src/Illuminate/Support/Stringable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ public function parseCallback($default = null)
444444
*/
445445
public function pipe(callable $callback)
446446
{
447-
return new static(call_user_func($callback, $this));
447+
return new static($callback($this));
448448
}
449449

450450
/**

0 commit comments

Comments
 (0)