Skip to content

Commit

Permalink
feat: stop using call_user_func (#121)
Browse files Browse the repository at this point in the history
* feat: stop using call_user_func

* add changelog
  • Loading branch information
taka-oyama authored Jul 19, 2023
1 parent 98bba00 commit 236ed91
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Added
Changed
- `Connection::waitForOperation` and `Connection::isDoneOperation` has been removed. (#99)
- Update `export-ignore` entries in `.gitattributes` (#104)
- Stop using `call_user_func` (#121)

Fixed
- Transaction state was not being cleared if rolled back failed. (#107)
Expand Down
4 changes: 1 addition & 3 deletions src/Concerns/ManagesStaleReads.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ public function cursorWithTimestampBound($query, $bindings = [], TimestampBoundI
{
return $this->run($query, $bindings, function ($query, $bindings) use ($timestampBound) {
if ($this->pretending()) {
return call_user_func(function() {
yield from [];
});
return (static fn() => yield from [])();
}

$options = ['parameters' => $this->prepareBindings($bindings)];
Expand Down
2 changes: 1 addition & 1 deletion src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public function cursor($query, $bindings = [], $useReadPdo = true): Generator
{
return $this->run($query, $bindings, function ($query, $bindings) {
if ($this->pretending()) {
return call_user_func(function() { yield from []; });
return (static fn() => yield from [])();
}

return $this->getDatabaseContext()
Expand Down
2 changes: 1 addition & 1 deletion src/Schema/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function dropIndexIfExist($table, $name)
protected function createBlueprint($table, Closure $callback = null)
{
return isset($this->resolver)
? call_user_func($this->resolver, $table, $callback)
? ($this->resolver)($table, $callback)
: new Blueprint($table, $callback);
}
}

0 comments on commit 236ed91

Please sign in to comment.