Skip to content

[12.x] Improve typing of arrays and callables #56470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 25 commits into
base: 12.x
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1a5dba6
Type $handler callable in Connection::whenQueryingForLongerThan()
shaedrich Jul 27, 2025
60b5cf4
Properly type $queryDurationHandlers as list of a associative arrays
shaedrich Jul 28, 2025
db1ab6e
Type rest of the Connection class
shaedrich Jul 28, 2025
45a73d9
Improve typing of closure and array
shaedrich Jul 28, 2025
8274fdc
Narrow array down
shaedrich Jul 28, 2025
731719a
Merge branch 'laravel:12.x' into type-arrays-and-callables-properly
shaedrich Jul 28, 2025
333123f
Improve join callback typing
shaedrich Jul 28, 2025
83c84ff
Improve typing in Controller
shaedrich Jul 28, 2025
898d79d
Improve types for ControllerMiddlewareOptions
shaedrich Jul 28, 2025
1f59536
Improve callable and array typing for PendingRequest
shaedrich Jul 28, 2025
0f0ae3f
Add types to CacheManager
shaedrich Jul 28, 2025
3c74adf
Type $prefixed
shaedrich Jul 28, 2025
f994214
Type lottery in DatabaseLock class
shaedrich Jul 28, 2025
f49a3e0
Type arrays in MemcachedConnector
shaedrich Jul 28, 2025
ce5ebf7
Make weight option optional
shaedrich Jul 28, 2025
ad89ac1
make weight optional in MemcachedConnector server configuration
shaedrich Jul 28, 2025
d8f5208
Type callback of Localizable::withLocale() and note its return value …
shaedrich Jul 28, 2025
173d50f
Type Closure in PendingProcess
shaedrich Jul 28, 2025
ac92ef0
Typo
shaedrich Jul 29, 2025
0c4ae2e
Fix typo
shaedrich Jul 29, 2025
8e40407
Type $$currentCursorResolver Closure in AbstractCursorPaginator
shaedrich Jul 30, 2025
c8dce8a
Type closure in HidesAttributes.php
shaedrich Jul 30, 2025
ce89cb5
StyleCI
shaedrich Jul 30, 2025
fe59f95
Type connection Closure in ConnectionFactory
shaedrich Jul 30, 2025
862684f
Type Closure return value of ManagesFrequencies::inTimeInterval()
shaedrich Jul 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Type rest of the Connection class
  • Loading branch information
shaedrich authored Jul 28, 2025
commit db1ab6e2ec6a1e92988e50d7c260fd72cb90b559
24 changes: 12 additions & 12 deletions src/Illuminate/Database/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ class Connection implements ConnectionInterface
/**
* The active PDO connection.
*
* @var \PDO|\Closure
* @var \PDO|(\Closure(): \PDO)
*/
protected $pdo;

/**
* The active PDO connection used for reads.
*
* @var \PDO|\Closure
* @var \PDO|(\Closure(): \PDO)
*/
protected $readPdo;

Expand Down Expand Up @@ -80,7 +80,7 @@ class Connection implements ConnectionInterface
/**
* The reconnector instance for the connection.
*
* @var callable
* @var (callable(\Illuminate\Database\Connection): mixed)
*/
protected $reconnector;

Expand Down Expand Up @@ -150,7 +150,7 @@ class Connection implements ConnectionInterface
/**
* All of the queries run against the connection.
*
* @var array
* @var array{query: string, bindings: array, time: float|null}[]
*/
protected $queryLog = [];

Expand Down Expand Up @@ -192,7 +192,7 @@ class Connection implements ConnectionInterface
/**
* All of the callbacks that should be invoked before a query is executed.
*
* @var \Closure[]
* @var (\Closure(string, array, \Illuminate\Database\Connection): mixed)[]
*/
protected $beforeExecutingCallbacks = [];

Expand All @@ -206,7 +206,7 @@ class Connection implements ConnectionInterface
/**
* Create a new database connection instance.
*
* @param \PDO|\Closure $pdo
* @param \PDO|(\Closure(): \PDO) $pdo
* @param string $database
* @param string $tablePrefix
* @param array $config
Expand Down Expand Up @@ -638,8 +638,8 @@ public function threadCount()
/**
* Execute the given callback in "dry run" mode.
*
* @param \Closure $callback
* @return array
* @param (\Closure(\Illuminate\Database\Connection): mixed) $callback
* @return array{query: string, bindings: array, time: float|null}[]
*/
public function pretend(Closure $callback)
{
Expand Down Expand Up @@ -681,8 +681,8 @@ public function withoutPretending(Closure $callback)
/**
* Execute the given callback in "dry run" mode.
*
* @param \Closure $callback
* @return array
* @param (\Closure(): array{query: string, bindings: array, time: float|null}[]) $callback
* @return array{query: string, bindings: array, time: float|null}[]
*/
protected function withFreshQueryLog($callback)
{
Expand Down Expand Up @@ -1307,7 +1307,7 @@ public function setReadPdo($pdo)
/**
* Set the reconnect instance on the connection.
*
* @param callable $reconnector
* @param (callable(\Illuminate\Database\Connection): mixed) $reconnector
* @return $this
*/
public function setReconnector(callable $reconnector)
Expand Down Expand Up @@ -1506,7 +1506,7 @@ public function pretending()
/**
* Get the connection query log.
*
* @return array
* @return array{query: string, bindings: array, time: float|null}[]
*/
public function getQueryLog()
{
Expand Down