From 1a5dba6820a5fe3141b1b7c6f43f744ddddae966 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Mon, 28 Jul 2025 01:54:17 +0200 Subject: [PATCH 01/25] Type $handler callable in Connection::whenQueryingForLongerThan() --- src/Illuminate/Database/Connection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Connection.php b/src/Illuminate/Database/Connection.php index fed6acc10e55..8e521624097f 100755 --- a/src/Illuminate/Database/Connection.php +++ b/src/Illuminate/Database/Connection.php @@ -876,7 +876,7 @@ protected function getElapsedTime($start) * Register a callback to be invoked when the connection queries for longer than a given amount of time. * * @param \DateTimeInterface|\Carbon\CarbonInterval|float|int $threshold - * @param callable $handler + * @param (callable(\Illuminate\Database\Connection, class-string<\Illuminate\Database\Events\QueryExecuted>): mixed) $handler * @return void */ public function whenQueryingForLongerThan($threshold, $handler) From 60b5cf449c51feb1749ce9fb42cc65c3c5d91d93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Mon, 28 Jul 2025 02:01:29 +0200 Subject: [PATCH 02/25] Properly type $queryDurationHandlers as list of a associative arrays --- src/Illuminate/Database/Connection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Connection.php b/src/Illuminate/Database/Connection.php index 8e521624097f..fbe6667bfa04 100755 --- a/src/Illuminate/Database/Connection.php +++ b/src/Illuminate/Database/Connection.php @@ -171,7 +171,7 @@ class Connection implements ConnectionInterface /** * All of the registered query duration handlers. * - * @var array + * @var array{has_run: bool, handler: (callable(\Illuminate\Database\Connection, class-string<\Illuminate\Database\Events\QueryExecuted>): mixed)}[] */ protected $queryDurationHandlers = []; From db1ab6e2ec6a1e92988e50d7c260fd72cb90b559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Mon, 28 Jul 2025 02:13:06 +0200 Subject: [PATCH 03/25] Type rest of the Connection class --- src/Illuminate/Database/Connection.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Illuminate/Database/Connection.php b/src/Illuminate/Database/Connection.php index fbe6667bfa04..9910fe911b66 100755 --- a/src/Illuminate/Database/Connection.php +++ b/src/Illuminate/Database/Connection.php @@ -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; @@ -80,7 +80,7 @@ class Connection implements ConnectionInterface /** * The reconnector instance for the connection. * - * @var callable + * @var (callable(\Illuminate\Database\Connection): mixed) */ protected $reconnector; @@ -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 = []; @@ -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 = []; @@ -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 @@ -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) { @@ -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) { @@ -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) @@ -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() { From 45a73d9291d9507035c87fed96a56e6967e6f9fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Mon, 28 Jul 2025 19:41:20 +0200 Subject: [PATCH 04/25] Improve typing of closure and array --- src/Illuminate/Support/Composer.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Illuminate/Support/Composer.php b/src/Illuminate/Support/Composer.php index 4f9ddaa6a053..88737474cfed 100644 --- a/src/Illuminate/Support/Composer.php +++ b/src/Illuminate/Support/Composer.php @@ -57,7 +57,7 @@ public function hasPackage($package) * * @param array $packages * @param bool $dev - * @param \Closure|\Symfony\Component\Console\Output\OutputInterface|null $output + * @param (\Closure('out'|'err', string): void)|\Symfony\Component\Console\Output\OutputInterface|null $output * @param string|null $composerBinary * @return bool */ @@ -86,7 +86,7 @@ public function requirePackages(array $packages, bool $dev = false, Closure|Outp * * @param array $packages * @param bool $dev - * @param \Closure|\Symfony\Component\Console\Output\OutputInterface|null $output + * @param (\Closure('out'|'err', string): void)|\Symfony\Component\Console\Output\OutputInterface|null $output * @param string|null $composerBinary * @return bool */ @@ -164,7 +164,7 @@ public function dumpOptimized($composerBinary = null) * Get the Composer binary / command for the environment. * * @param string|null $composerBinary - * @return array + * @return array{string, string}|array{'composer'} */ public function findComposer($composerBinary = null) { From 8274fdc3ec1088e8ca85480dc2f81b44497a3d09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Mon, 28 Jul 2025 19:47:08 +0200 Subject: [PATCH 05/25] Narrow array down --- src/Illuminate/Pipeline/Pipeline.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Pipeline/Pipeline.php b/src/Illuminate/Pipeline/Pipeline.php index 6b99d025936a..61cad253d17c 100644 --- a/src/Illuminate/Pipeline/Pipeline.php +++ b/src/Illuminate/Pipeline/Pipeline.php @@ -229,7 +229,7 @@ protected function carry() * Parse full pipe string to get name and parameters. * * @param string $pipe - * @return array + * @return array */ protected function parsePipeString($pipe) { From 333123f300255cdc65d75339c3f8686da2e3e7bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Mon, 28 Jul 2025 19:53:32 +0200 Subject: [PATCH 06/25] Improve join callback typing --- src/Illuminate/Database/Query/JoinClause.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Database/Query/JoinClause.php b/src/Illuminate/Database/Query/JoinClause.php index d5733f35504b..a31487a0bfb4 100755 --- a/src/Illuminate/Database/Query/JoinClause.php +++ b/src/Illuminate/Database/Query/JoinClause.php @@ -81,7 +81,7 @@ public function __construct(Builder $parentQuery, $type, $table) * * on `contacts`.`user_id` = `users`.`id` and `contacts`.`info_id` = `info`.`id` * - * @param \Closure|\Illuminate\Contracts\Database\Query\Expression|string $first + * @param (\Closure(\Illuminate\Database\Query\Builder): mixed)|\Illuminate\Contracts\Database\Query\Expression|string $first * @param string|null $operator * @param \Illuminate\Contracts\Database\Query\Expression|string|null $second * @param string $boolean @@ -101,7 +101,7 @@ public function on($first, $operator = null, $second = null, $boolean = 'and') /** * Add an "or on" clause to the join. * - * @param \Closure|\Illuminate\Contracts\Database\Query\Expression|string $first + * @param (\Closure(\Illuminate\Database\Query\Builder): mixed)|\Illuminate\Contracts\Database\Query\Expression|string $first * @param string|null $operator * @param \Illuminate\Contracts\Database\Query\Expression|string|null $second * @return \Illuminate\Database\Query\JoinClause From 83c84ff267ca971857a771dc9c4bed54cf7db8e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Mon, 28 Jul 2025 20:08:00 +0200 Subject: [PATCH 07/25] Improve typing in Controller --- src/Illuminate/Routing/Controller.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Illuminate/Routing/Controller.php b/src/Illuminate/Routing/Controller.php index a26a5ee7effa..4353b3d6a5a1 100644 --- a/src/Illuminate/Routing/Controller.php +++ b/src/Illuminate/Routing/Controller.php @@ -9,15 +9,15 @@ abstract class Controller /** * The middleware registered on the controller. * - * @var array + * @var array{middleware: \Closure|string, options: array{only: (string|mixed)[], except: (string|mixed)[]}}[] */ protected $middleware = []; /** * Register middleware on the controller. * - * @param \Closure|array|string $middleware - * @param array $options + * @param \Closure|array|string $middleware + * @param array{only: (string|mixed)[], except: (string|mixed)[]} $options * @return \Illuminate\Routing\ControllerMiddlewareOptions */ public function middleware($middleware, array $options = []) From 898d79d0d990352c9df07f2ee868ed2ccbbfb251 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Mon, 28 Jul 2025 20:09:52 +0200 Subject: [PATCH 08/25] Improve types for ControllerMiddlewareOptions --- src/Illuminate/Routing/ControllerMiddlewareOptions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Routing/ControllerMiddlewareOptions.php b/src/Illuminate/Routing/ControllerMiddlewareOptions.php index 9fb468f22018..053bcbf3ffd5 100644 --- a/src/Illuminate/Routing/ControllerMiddlewareOptions.php +++ b/src/Illuminate/Routing/ControllerMiddlewareOptions.php @@ -7,14 +7,14 @@ class ControllerMiddlewareOptions /** * The middleware options. * - * @var array + * @var array{only: (string|mixed)[], except: (string|mixed)[]} */ protected $options; /** * Create a new middleware option instance. * - * @param array $options + * @param array{only: (string|mixed)[], except: (string|mixed)[]} $options */ public function __construct(array &$options) { From 1f595363421da86266c5584aa344fd0ddc5ac8ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Mon, 28 Jul 2025 20:25:25 +0200 Subject: [PATCH 09/25] Improve callable and array typing for PendingRequest --- src/Illuminate/Http/Client/PendingRequest.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Illuminate/Http/Client/PendingRequest.php b/src/Illuminate/Http/Client/PendingRequest.php index 120329743ff8..f2d03de459e7 100644 --- a/src/Illuminate/Http/Client/PendingRequest.php +++ b/src/Illuminate/Http/Client/PendingRequest.php @@ -625,7 +625,7 @@ public function retry(array|int $times, Closure|int $sleepMilliseconds = 0, ?cal /** * Replace the specified options on the request. * - * @param array $options + * @param array<'cookies'|'form_params'|'headers'|'json'|'multipart'|'query', mixed> $options * @return $this */ public function withOptions(array $options) @@ -1312,7 +1312,7 @@ public function pushHandlers($handlerStack) /** * Build the before sending handler. * - * @return \Closure + * @return (\Closure(callable): callable) */ public function buildBeforeSendingHandler() { @@ -1326,7 +1326,7 @@ public function buildBeforeSendingHandler() /** * Build the recorder handler. * - * @return \Closure + * @return (\Closure(callable): callable) */ public function buildRecorderHandler() { @@ -1349,7 +1349,7 @@ public function buildRecorderHandler() /** * Build the stub handler. * - * @return \Closure + * @return (\Closure(callable): callable) */ public function buildStubHandler() { @@ -1386,7 +1386,7 @@ public function buildStubHandler() * Get the sink stub handler callback. * * @param string $sink - * @return \Closure + * @return (\Closure(\Illuminate\Http\Client\Response): void) */ protected function sinkStubHandler($sink) { From 0f0ae3fd581bf1d682b2bb5b9b5abef40da045c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Mon, 28 Jul 2025 21:01:49 +0200 Subject: [PATCH 10/25] Add types to CacheManager --- src/Illuminate/Cache/CacheManager.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/Illuminate/Cache/CacheManager.php b/src/Illuminate/Cache/CacheManager.php index 0a0c2de5e171..1d08ba2b080f 100755 --- a/src/Illuminate/Cache/CacheManager.php +++ b/src/Illuminate/Cache/CacheManager.php @@ -114,7 +114,7 @@ public function resolve($name) /** * Build a cache repository with the given configuration. * - * @param array $config + * @param array{driver: string, name?: string} $config * @return \Illuminate\Cache\Repository */ public function build(array $config) @@ -137,7 +137,7 @@ public function build(array $config) /** * Call a custom driver creator. * - * @param array $config + * @param array{driver: string} $config * @return mixed */ protected function callCustomCreator(array $config) @@ -161,7 +161,7 @@ protected function createApcDriver(array $config) /** * Create an instance of the array cache driver. * - * @param array $config + * @param array{serialize?: bool} $config * @return \Illuminate\Cache\Repository */ protected function createArrayDriver(array $config) @@ -172,7 +172,7 @@ protected function createArrayDriver(array $config) /** * Create an instance of the file cache driver. * - * @param array $config + * @param array{path: string, lock_path: string, permission?: int} $config * @return \Illuminate\Cache\Repository */ protected function createFileDriver(array $config) @@ -187,7 +187,7 @@ protected function createFileDriver(array $config) /** * Create an instance of the Memcached cache driver. * - * @param array $config + * @param array{servers: array{host: strint, port: int, weight: int}[], persistent_id?: string|null, options?: array, sasl?: array{string, string}} $config * @return \Illuminate\Cache\Repository */ protected function createMemcachedDriver(array $config) @@ -217,7 +217,7 @@ protected function createNullDriver() /** * Create an instance of the Redis cache driver. * - * @param array $config + * @param array{connection?: sttring, lock_connection?: string} $config * @return \Illuminate\Cache\Repository */ protected function createRedisDriver(array $config) @@ -237,7 +237,7 @@ protected function createRedisDriver(array $config) /** * Create an instance of the database cache driver. * - * @param array $config + * @param array{table: string, connection?: string, lock_table?: string, lock_lottery?: array{int, int}, lock_timeout?: int, lock_connection?: string} $config * @return \Illuminate\Cache\Repository */ protected function createDatabaseDriver(array $config) @@ -264,7 +264,7 @@ protected function createDatabaseDriver(array $config) /** * Create an instance of the DynamoDB cache driver. * - * @param array $config + * @param array{table: string, attributes?: array{key?: string, value?: string, expiration?: string}} $config * @return \Illuminate\Cache\Repository */ protected function createDynamodbDriver(array $config) @@ -287,6 +287,7 @@ protected function createDynamodbDriver(array $config) /** * Create new DynamoDb Client instance. * + * @param array{region: string, endpoint?: string, key?: string, secret?: string, token?: string} $config * @return \Aws\DynamoDb\DynamoDbClient */ protected function newDynamodbClient(array $config) @@ -314,7 +315,7 @@ protected function newDynamodbClient(array $config) * Create a new cache repository with the given implementation. * * @param \Illuminate\Contracts\Cache\Store $store - * @param array $config + * @param array{store?: string, events: bool} $config * @return \Illuminate\Cache\Repository */ public function repository(Store $store, array $config = []) @@ -356,7 +357,7 @@ public function refreshEventDispatcher() /** * Get the cache prefix. * - * @param array $config + * @param array{prefix?: string} $config * @return string */ protected function getPrefix(array $config) @@ -403,7 +404,7 @@ public function setDefaultDriver($name) /** * Unset the given driver instances. * - * @param array|string|null $name + * @param string[]|string|null $name * @return $this */ public function forgetDriver($name = null) From 3c74adfc052145ad58aae18b31a02da7d9e99c5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Mon, 28 Jul 2025 21:19:27 +0200 Subject: [PATCH 11/25] Type $prefixed --- src/Illuminate/Cache/DatabaseStore.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Illuminate/Cache/DatabaseStore.php b/src/Illuminate/Cache/DatabaseStore.php index 2d5fd6d03b92..1762f7b4ee8b 100755 --- a/src/Illuminate/Cache/DatabaseStore.php +++ b/src/Illuminate/Cache/DatabaseStore.php @@ -57,7 +57,7 @@ class DatabaseStore implements LockProvider, Store /** * An array representation of the lock lottery odds. * - * @var array + * @var array{int, int} */ protected $lockLottery; @@ -75,7 +75,7 @@ class DatabaseStore implements LockProvider, Store * @param string $table * @param string $prefix * @param string $lockTable - * @param array $lockLottery + * @param array{int, int} $lockLottery * @param int $defaultLockTimeoutInSeconds */ public function __construct( @@ -253,10 +253,13 @@ public function decrement($key, $value = 1) /** * Increment or decrement an item in the cache. * + * @template TValue of int|float + * @template TReturn of int|false + * * @param string $key - * @param int|float $value - * @param \Closure $callback - * @return int|false + * @param TValue $value + * @param (\Closure(int, TValue): TReturn) $callback + * @return TReturn */ protected function incrementOrDecrement($key, $value, Closure $callback) { @@ -377,7 +380,7 @@ public function forgetIfExpired($key) /** * Remove all items from the cache. * - * @param array $keys + * @param array $keys * @return bool */ protected function forgetMany(array $keys) @@ -393,7 +396,7 @@ protected function forgetMany(array $keys) /** * Remove all expired items from the given set from the cache. * - * @param array $keys + * @param array $keys * @param bool $prefixed * @return bool */ From f994214afd7be0a7e7d1fada770a7f4067239dcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Mon, 28 Jul 2025 21:20:44 +0200 Subject: [PATCH 12/25] Type lottery in DatabaseLock class --- src/Illuminate/Cache/DatabaseLock.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Cache/DatabaseLock.php b/src/Illuminate/Cache/DatabaseLock.php index d490f8c05048..ed9318c9421a 100644 --- a/src/Illuminate/Cache/DatabaseLock.php +++ b/src/Illuminate/Cache/DatabaseLock.php @@ -24,7 +24,7 @@ class DatabaseLock extends Lock /** * The prune probability odds. * - * @var array + * @var array{int, int} */ protected $lottery; @@ -43,7 +43,7 @@ class DatabaseLock extends Lock * @param string $name * @param int $seconds * @param string|null $owner - * @param array $lottery + * @param array{int, int} $lottery * @param int $defaultTimeoutInSeconds */ public function __construct(Connection $connection, $table, $name, $seconds, $owner = null, $lottery = [2, 100], $defaultTimeoutInSeconds = 86400) From f49a3e0fa354ec077ba5cddcb75fcce8b1e65549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Mon, 28 Jul 2025 21:22:45 +0200 Subject: [PATCH 13/25] Type arrays in MemcachedConnector --- src/Illuminate/Cache/MemcachedConnector.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Illuminate/Cache/MemcachedConnector.php b/src/Illuminate/Cache/MemcachedConnector.php index 224d94099bf3..d42f768607d6 100755 --- a/src/Illuminate/Cache/MemcachedConnector.php +++ b/src/Illuminate/Cache/MemcachedConnector.php @@ -9,10 +9,10 @@ class MemcachedConnector /** * Create a new Memcached connection. * - * @param array $servers + * @param array{host: strint, port: int, weight: int}[] $servers * @param string|null $connectionId * @param array $options - * @param array $credentials + * @param array{string, string} $credentials * @return \Memcached */ public function connect(array $servers, $connectionId = null, array $options = [], array $credentials = []) @@ -39,7 +39,7 @@ public function connect(array $servers, $connectionId = null, array $options = [ * Get a new Memcached instance. * * @param string|null $connectionId - * @param array $credentials + * @param array{string, string} $credentials * @param array $options * @return \Memcached */ @@ -73,7 +73,7 @@ protected function createMemcachedInstance($connectionId) * Set the SASL credentials on the Memcached connection. * * @param \Memcached $memcached - * @param array $credentials + * @param array{string, string} $credentials * @return void */ protected function setCredentials($memcached, $credentials) From ce5ebf72132d0fcd264022522822ebffd672d1c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Mon, 28 Jul 2025 21:25:43 +0200 Subject: [PATCH 14/25] Make weight option optional --- src/Illuminate/Cache/CacheManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Cache/CacheManager.php b/src/Illuminate/Cache/CacheManager.php index 1d08ba2b080f..541b26404d2d 100755 --- a/src/Illuminate/Cache/CacheManager.php +++ b/src/Illuminate/Cache/CacheManager.php @@ -187,7 +187,7 @@ protected function createFileDriver(array $config) /** * Create an instance of the Memcached cache driver. * - * @param array{servers: array{host: strint, port: int, weight: int}[], persistent_id?: string|null, options?: array, sasl?: array{string, string}} $config + * @param array{servers: array{host: strint, port: int, weight?: int}[], persistent_id?: string|null, options?: array, sasl?: array{string, string}} $config * @return \Illuminate\Cache\Repository */ protected function createMemcachedDriver(array $config) From ad89ac1ad9d547bf150734565fb41a901152685f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Mon, 28 Jul 2025 21:26:36 +0200 Subject: [PATCH 15/25] make weight optional in MemcachedConnector server configuration --- src/Illuminate/Cache/MemcachedConnector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Cache/MemcachedConnector.php b/src/Illuminate/Cache/MemcachedConnector.php index d42f768607d6..fa840d2b918c 100755 --- a/src/Illuminate/Cache/MemcachedConnector.php +++ b/src/Illuminate/Cache/MemcachedConnector.php @@ -9,7 +9,7 @@ class MemcachedConnector /** * Create a new Memcached connection. * - * @param array{host: strint, port: int, weight: int}[] $servers + * @param array{host: strint, port: int, weight?: int}[] $servers * @param string|null $connectionId * @param array $options * @param array{string, string} $credentials From d8f52081dd95253f0aa8ea8ea7e010968e8bc1c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Mon, 28 Jul 2025 21:35:40 +0200 Subject: [PATCH 16/25] Type callback of Localizable::withLocale() and note its return value as withLocales() --- src/Illuminate/Support/Traits/Localizable.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Support/Traits/Localizable.php b/src/Illuminate/Support/Traits/Localizable.php index 1e9fa58c90bf..d9464eb756a0 100644 --- a/src/Illuminate/Support/Traits/Localizable.php +++ b/src/Illuminate/Support/Traits/Localizable.php @@ -9,9 +9,11 @@ trait Localizable /** * Run the callback with the given locale. * + * @template TReturn + * * @param string $locale - * @param \Closure $callback - * @return mixed + * @param (\Closure(): TReturn) $callback + * @return TReturn */ public function withLocale($locale, $callback) { From 173d50ff68306b650d27f249b1d332eb75a98440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Mon, 28 Jul 2025 22:59:38 +0200 Subject: [PATCH 17/25] Type Closure in PendingProcess --- src/Illuminate/Process/PendingProcess.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Illuminate/Process/PendingProcess.php b/src/Illuminate/Process/PendingProcess.php index f48899f69a5f..59569c2622d5 100644 --- a/src/Illuminate/Process/PendingProcess.php +++ b/src/Illuminate/Process/PendingProcess.php @@ -366,8 +366,8 @@ protected function fakeFor(string $command) * Resolve the given fake handler for a synchronous process. * * @param string $command - * @param \Closure $fake - * @return mixed + * @param (\Closure(\Illuminate\Process\PendingProcess): int|string|array|\Illuminate\Process\ProcessResult|\Illuminate\Process\FakeProcessResult|\Illuminate\Process\FakeProcessDescription|\Illuminate\Process\FakeProcessSequence|\Throwable) $fake + * @return \Illuminate\Process\FakeProcessResult|\Illuminate\Contracts\Process\ProcessResult|\Illuminate\Process\FakeProcessDescription|mixed */ protected function resolveSynchronousFake(string $command, Closure $fake) { @@ -396,7 +396,7 @@ protected function resolveSynchronousFake(string $command, Closure $fake) * * @param string $command * @param callable|null $output - * @param \Closure $fake + * @param (\Closure(\Illuminate\Process\PendingProcess): int|string|array|\Illuminate\Process\ProcessResult|\Illuminate\Process\FakeProcessResult|\Illuminate\Process\FakeProcessDescription|\Illuminate\Process\FakeProcessSequence|\Throwable) $fake * @return \Illuminate\Process\FakeInvokedProcess * * @throws \LogicException From ac92ef04604c889f089847770a8b3f53d8fcafed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Tue, 29 Jul 2025 23:15:56 +0200 Subject: [PATCH 18/25] Typo --- src/Illuminate/Cache/CacheManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Cache/CacheManager.php b/src/Illuminate/Cache/CacheManager.php index 541b26404d2d..2e4d0489fbd9 100755 --- a/src/Illuminate/Cache/CacheManager.php +++ b/src/Illuminate/Cache/CacheManager.php @@ -187,7 +187,7 @@ protected function createFileDriver(array $config) /** * Create an instance of the Memcached cache driver. * - * @param array{servers: array{host: strint, port: int, weight?: int}[], persistent_id?: string|null, options?: array, sasl?: array{string, string}} $config + * @param array{servers: array{host: string, port: int, weight?: int}[], persistent_id?: string|null, options?: array, sasl?: array{string, string}} $config * @return \Illuminate\Cache\Repository */ protected function createMemcachedDriver(array $config) From 0c4ae2e2c2a62534812da85eb19fe72688e2340b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Tue, 29 Jul 2025 23:16:27 +0200 Subject: [PATCH 19/25] Fix typo --- src/Illuminate/Cache/MemcachedConnector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Cache/MemcachedConnector.php b/src/Illuminate/Cache/MemcachedConnector.php index fa840d2b918c..8a51a6f5d0e6 100755 --- a/src/Illuminate/Cache/MemcachedConnector.php +++ b/src/Illuminate/Cache/MemcachedConnector.php @@ -9,7 +9,7 @@ class MemcachedConnector /** * Create a new Memcached connection. * - * @param array{host: strint, port: int, weight?: int}[] $servers + * @param array{host: string, port: int, weight?: int}[] $servers * @param string|null $connectionId * @param array $options * @param array{string, string} $credentials From 8e40407bf14c6466a89cca139bc98509242a97c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 30 Jul 2025 21:59:58 +0200 Subject: [PATCH 20/25] Type $$currentCursorResolver Closure in AbstractCursorPaginator --- src/Illuminate/Pagination/AbstractCursorPaginator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Pagination/AbstractCursorPaginator.php b/src/Illuminate/Pagination/AbstractCursorPaginator.php index fea9fdc22574..5f7f8b4256f1 100644 --- a/src/Illuminate/Pagination/AbstractCursorPaginator.php +++ b/src/Illuminate/Pagination/AbstractCursorPaginator.php @@ -95,7 +95,7 @@ abstract class AbstractCursorPaginator implements Htmlable, Stringable /** * The current cursor resolver callback. * - * @var \Closure + * @var (\Closure(string): \Illuminate\Pagination\Cursor|null) */ protected static $currentCursorResolver; @@ -512,7 +512,7 @@ public static function resolveCurrentCursor($cursorName = 'cursor', $default = n /** * Set the current cursor resolver callback. * - * @param \Closure $resolver + * @param (\Closure(string): \Illuminate\Pagination\Cursor|null) $resolver * @return void */ public static function currentCursorResolver(Closure $resolver) From c8dce8aa5ee1614a257367994dee8b61f1d2d010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 30 Jul 2025 22:05:54 +0200 Subject: [PATCH 21/25] Type closure in HidesAttributes.php --- src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php b/src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php index c124fc60324e..ee7ab265e25b 100644 --- a/src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php +++ b/src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php @@ -86,7 +86,7 @@ public function makeVisible($attributes) /** * Make the given, typically hidden, attributes visible if the given truth test passes. * - * @param bool|\Closure $condition + * @param bool|(\Closure(\Illuminate\Database\Eloquent\Model): bool) $condition * @param array|string|null $attributes * @return $this */ @@ -113,7 +113,7 @@ public function makeHidden($attributes) /** * Make the given, typically visible, attributes hidden if the given truth test passes. * - * @param bool|\Closure $condition + * @param bool|(\Closure(\Illuminate\Database\Eloquent\Model): bool) $condition * @param array|string|null $attributes * @return $this */ From ce89cb50e39325251e2c5a177a9f788fdef8eaff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 30 Jul 2025 22:07:15 +0200 Subject: [PATCH 22/25] StyleCI --- src/Illuminate/Pagination/AbstractCursorPaginator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Pagination/AbstractCursorPaginator.php b/src/Illuminate/Pagination/AbstractCursorPaginator.php index 5f7f8b4256f1..0deb329a5558 100644 --- a/src/Illuminate/Pagination/AbstractCursorPaginator.php +++ b/src/Illuminate/Pagination/AbstractCursorPaginator.php @@ -95,7 +95,7 @@ abstract class AbstractCursorPaginator implements Htmlable, Stringable /** * The current cursor resolver callback. * - * @var (\Closure(string): \Illuminate\Pagination\Cursor|null) + * @var (\Closure(string): \Illuminate\Pagination\Cursor|null) */ protected static $currentCursorResolver; From fe59f95936664360bf8f393ff17e50ca5253b859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 30 Jul 2025 22:19:31 +0200 Subject: [PATCH 23/25] Type connection Closure in ConnectionFactory --- src/Illuminate/Database/Connectors/ConnectionFactory.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Illuminate/Database/Connectors/ConnectionFactory.php b/src/Illuminate/Database/Connectors/ConnectionFactory.php index 8660921633a0..4447cd9a9cf9 100755 --- a/src/Illuminate/Database/Connectors/ConnectionFactory.php +++ b/src/Illuminate/Database/Connectors/ConnectionFactory.php @@ -94,7 +94,7 @@ protected function createReadWriteConnection(array $config) * Create a new PDO instance for reading. * * @param array $config - * @return \Closure + * @return (\Closure(array): \PDO) */ protected function createReadPdo(array $config) { @@ -157,7 +157,7 @@ protected function mergeReadWriteConfig(array $config, array $merge) * Create a new Closure that resolves to a PDO instance. * * @param array $config - * @return \Closure + * @return (\Closure(array): \PDO) */ protected function createPdoResolver(array $config) { @@ -170,7 +170,7 @@ protected function createPdoResolver(array $config) * Create a new Closure that resolves to a PDO instance with a specific host or an array of hosts. * * @param array $config - * @return \Closure + * @return (\Closure(array): \PDO) * * @throws \PDOException */ @@ -216,7 +216,7 @@ protected function parseHosts(array $config) * Create a new Closure that resolves to a PDO instance where there is no configured host. * * @param array $config - * @return \Closure + * @return (\Closure(array): \PDO) */ protected function createPdoResolverWithoutHosts(array $config) { From 862684f9117db7140b60fd6d5013817a0fbf8356 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Wed, 30 Jul 2025 22:33:02 +0200 Subject: [PATCH 24/25] Type Closure return value of ManagesFrequencies::inTimeInterval() --- src/Illuminate/Console/Scheduling/ManagesFrequencies.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php index f0f6678d79db..d494ce73d8a0 100644 --- a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php +++ b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php @@ -51,7 +51,7 @@ public function unlessBetween($startTime, $endTime) * * @param string $startTime * @param string $endTime - * @return \Closure + * @return (\Closure(): bool) */ private function inTimeInterval($startTime, $endTime) { From ee13813560dbb0e9429787b951f6092f57657bb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Thu, 14 Aug 2025 10:59:24 +0200 Subject: [PATCH 25/25] Fix typo --- src/Illuminate/Cache/CacheManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Cache/CacheManager.php b/src/Illuminate/Cache/CacheManager.php index 2e4d0489fbd9..770b9af5a506 100755 --- a/src/Illuminate/Cache/CacheManager.php +++ b/src/Illuminate/Cache/CacheManager.php @@ -217,7 +217,7 @@ protected function createNullDriver() /** * Create an instance of the Redis cache driver. * - * @param array{connection?: sttring, lock_connection?: string} $config + * @param array{connection?: string, lock_connection?: string} $config * @return \Illuminate\Cache\Repository */ protected function createRedisDriver(array $config)