laravel / framework

The Laravel Framework.
https://laravel.com
MIT License
32.64k stars 11.04k forks source link

Wrong method return documentation for DB::transaction in DB Facade #53526

Closed dragonofmercy closed 1 week ago

dragonofmercy commented 1 week ago

Laravel Version

11.31

PHP Version

8.2

Database Driver & Version

No response

Description

DB::transaction method documentation dosen't match Illuminate/Database/Concerns/ManagesTransactions.php

In Facade

/**
 * @method static void transaction(\Closure $callback, int $attempts = 1)
 */

In trait ManagesTransactions

/**
 * @template TReturn of mixed
 *
 * Execute a Closure within a transaction.
 *
 * @param  (\Closure(static): TReturn)  $callback
 * @param  int  $attempts
 * @return TReturn
 *
 * @throws \Throwable
 */

Steps To Reproduce

Use DB::transaction in IDE with return will make an inspection error

crynobone commented 1 week ago

Hey there, thanks for reporting this issue.

If you notice improper DocBlock, PHPStan, or IDE warnings while using Laravel, do not create a GitHub issue. Instead, please submit a pull request to fix the problem. Also see our contribution guide.

Thanks!

timacdonald commented 4 days ago

This will be fixed shortly.

https://github.com/laravel/framework/pull/53550